commit
969f93cb49
@ -0,0 +1,4 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" /> |
||||||
|
</project> |
@ -0,0 +1,9 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<module type="WEB_MODULE" version="4"> |
||||||
|
<component name="Go" enabled="true" /> |
||||||
|
<component name="NewModuleRootManager"> |
||||||
|
<content url="file://$MODULE_DIR$" /> |
||||||
|
<orderEntry type="inheritedJdk" /> |
||||||
|
<orderEntry type="sourceFolder" forTests="false" /> |
||||||
|
</component> |
||||||
|
</module> |
@ -0,0 +1,6 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="JavaScriptSettings"> |
||||||
|
<option name="languageLevel" value="ES6" /> |
||||||
|
</component> |
||||||
|
</project> |
@ -0,0 +1,8 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="ProjectModuleManager"> |
||||||
|
<modules> |
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/go_sl500.iml" filepath="$PROJECT_DIR$/.idea/go_sl500.iml" /> |
||||||
|
</modules> |
||||||
|
</component> |
||||||
|
</project> |
@ -0,0 +1,6 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="VcsDirectoryMappings"> |
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" /> |
||||||
|
</component> |
||||||
|
</project> |
@ -0,0 +1,221 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="ChangeListManager"> |
||||||
|
<list default="true" id="6c1c4551-31f7-4ff7-86a0-8e44a0d431e7" name="Default Changelist" comment="" /> |
||||||
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> |
||||||
|
<option name="SHOW_DIALOG" value="false" /> |
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" /> |
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> |
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" /> |
||||||
|
</component> |
||||||
|
<component name="FileEditorManager"> |
||||||
|
<splitter split-orientation="horizontal" split-proportion="0.5"> |
||||||
|
<split-first> |
||||||
|
<leaf> |
||||||
|
<file pinned="false" current-in-tab="true"> |
||||||
|
<entry file="file://$PROJECT_DIR$/serve.go"> |
||||||
|
<provider selected="true" editor-type-id="text-editor"> |
||||||
|
<state relative-caret-position="102"> |
||||||
|
<caret line="6" column="1" selection-start-line="6" selection-start-column="1" selection-end-line="6" selection-end-column="1" /> |
||||||
|
<folding> |
||||||
|
<element signature="e#14#64#0" expanded="true" /> |
||||||
|
</folding> |
||||||
|
</state> |
||||||
|
</provider> |
||||||
|
</entry> |
||||||
|
</file> |
||||||
|
</leaf> |
||||||
|
</split-first> |
||||||
|
<split-second> |
||||||
|
<leaf> |
||||||
|
<file pinned="false" current-in-tab="false"> |
||||||
|
<entry file="file://$PROJECT_DIR$/../sl500-api/sl500_test.go"> |
||||||
|
<provider selected="true" editor-type-id="text-editor"> |
||||||
|
<state relative-caret-position="442"> |
||||||
|
<caret line="26" column="38" selection-start-line="26" selection-start-column="30" selection-end-line="26" selection-end-column="38" /> |
||||||
|
<folding> |
||||||
|
<element signature="e#24#84#0" expanded="true" /> |
||||||
|
</folding> |
||||||
|
</state> |
||||||
|
</provider> |
||||||
|
</entry> |
||||||
|
</file> |
||||||
|
<file pinned="false" current-in-tab="true"> |
||||||
|
<entry file="file://$PROJECT_DIR$/../sl500-api/sl500.go"> |
||||||
|
<provider selected="true" editor-type-id="text-editor"> |
||||||
|
<state relative-caret-position="204"> |
||||||
|
<caret line="32" column="7" selection-start-line="32" selection-start-column="7" selection-end-line="32" selection-end-column="7" /> |
||||||
|
<folding> |
||||||
|
<element signature="e#19#109#0" expanded="true" /> |
||||||
|
</folding> |
||||||
|
</state> |
||||||
|
</provider> |
||||||
|
</entry> |
||||||
|
</file> |
||||||
|
</leaf> |
||||||
|
</split-second> |
||||||
|
</splitter> |
||||||
|
</component> |
||||||
|
<component name="FileTemplateManagerImpl"> |
||||||
|
<option name="RECENT_TEMPLATES"> |
||||||
|
<list> |
||||||
|
<option value="Go File" /> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
</component> |
||||||
|
<component name="FindInProjectRecents"> |
||||||
|
<findStrings> |
||||||
|
<find>go</find> |
||||||
|
<find>Wrong length for rf request</find> |
||||||
|
<find>RfSelect</find> |
||||||
|
<find>RfM1Authentication2</find> |
||||||
|
<find>appe</find> |
||||||
|
<find>timeout</find> |
||||||
|
<find>readResponseWithTimeout</find> |
||||||
|
<find>s.timeout</find> |
||||||
|
</findStrings> |
||||||
|
</component> |
||||||
|
<component name="GOROOT" path="C:\Go" /> |
||||||
|
<component name="Git.Settings"> |
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> |
||||||
|
</component> |
||||||
|
<component name="IdeDocumentHistory"> |
||||||
|
<option name="CHANGED_PATHS"> |
||||||
|
<list> |
||||||
|
<option value="$PROJECT_DIR$/../sl500-api/sl500.go" /> |
||||||
|
<option value="$PROJECT_DIR$/serve.go" /> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
</component> |
||||||
|
<component name="ProjectFrameBounds" extendedState="6"> |
||||||
|
<option name="x" value="-8" /> |
||||||
|
<option name="y" value="-8" /> |
||||||
|
<option name="width" value="2576" /> |
||||||
|
<option name="height" value="1416" /> |
||||||
|
</component> |
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> |
||||||
|
<component name="ProjectView"> |
||||||
|
<navigator proportions="" version="1"> |
||||||
|
<foldersAlwaysOnTop value="true" /> |
||||||
|
</navigator> |
||||||
|
<panes> |
||||||
|
<pane id="Scope" /> |
||||||
|
<pane id="ProjectPane"> |
||||||
|
<subPane> |
||||||
|
<expand> |
||||||
|
<path> |
||||||
|
<item name="go_sl500" type="b2602c69:ProjectViewProjectNode" /> |
||||||
|
<item name="go_sl500" type="462c0819:PsiDirectoryNode" /> |
||||||
|
</path> |
||||||
|
</expand> |
||||||
|
<select /> |
||||||
|
</subPane> |
||||||
|
</pane> |
||||||
|
</panes> |
||||||
|
</component> |
||||||
|
<component name="PropertiesComponent"> |
||||||
|
<property name="DefaultGoTemplateProperty" value="Go File" /> |
||||||
|
<property name="WebServerToolWindowFactoryState" value="false" /> |
||||||
|
<property name="go.gopath.indexing.explicitly.defined" value="true" /> |
||||||
|
<property name="last_opened_file_path" value="$PROJECT_DIR$/../sl500-api" /> |
||||||
|
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> |
||||||
|
<property name="nodejs_npm_path_reset_for_default_project" value="true" /> |
||||||
|
</component> |
||||||
|
<component name="RunDashboard"> |
||||||
|
<option name="ruleStates"> |
||||||
|
<list> |
||||||
|
<RuleState> |
||||||
|
<option name="name" value="ConfigurationTypeDashboardGroupingRule" /> |
||||||
|
</RuleState> |
||||||
|
<RuleState> |
||||||
|
<option name="name" value="StatusDashboardGroupingRule" /> |
||||||
|
</RuleState> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
</component> |
||||||
|
<component name="RunManager"> |
||||||
|
<configuration name="go build serve.go" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true"> |
||||||
|
<module name="go_sl500" /> |
||||||
|
<working_directory value="$PROJECT_DIR$/" /> |
||||||
|
<kind value="FILE" /> |
||||||
|
<filePath value="$PROJECT_DIR$/serve.go" /> |
||||||
|
<package value="go_sl500" /> |
||||||
|
<directory value="$PROJECT_DIR$/" /> |
||||||
|
<method v="2" /> |
||||||
|
</configuration> |
||||||
|
<recent_temporary> |
||||||
|
<list> |
||||||
|
<item itemvalue="Go Build.go build serve.go" /> |
||||||
|
</list> |
||||||
|
</recent_temporary> |
||||||
|
</component> |
||||||
|
<component name="ToolWindowManager"> |
||||||
|
<frame x="-8" y="-8" width="2576" height="1416" extended-state="6" /> |
||||||
|
<editor active="true" /> |
||||||
|
<layout> |
||||||
|
<window_info id="Favorites" side_tool="true" /> |
||||||
|
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.10969793" /> |
||||||
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> |
||||||
|
<window_info anchor="bottom" id="Docker" show_stripe_button="false" /> |
||||||
|
<window_info anchor="bottom" id="Database Changes" /> |
||||||
|
<window_info anchor="bottom" id="Version Control" /> |
||||||
|
<window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.32969603" /> |
||||||
|
<window_info anchor="bottom" id="Event Log" side_tool="true" /> |
||||||
|
<window_info anchor="bottom" id="Message" order="0" /> |
||||||
|
<window_info anchor="bottom" id="Find" order="1" /> |
||||||
|
<window_info anchor="bottom" id="Run" order="2" weight="0.32969603" /> |
||||||
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.3998441" /> |
||||||
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> |
||||||
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> |
||||||
|
<window_info anchor="bottom" id="TODO" order="6" /> |
||||||
|
<window_info anchor="right" id="Database" /> |
||||||
|
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> |
||||||
|
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> |
||||||
|
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> |
||||||
|
</layout> |
||||||
|
</component> |
||||||
|
<component name="TypeScriptGeneratedFilesManager"> |
||||||
|
<option name="version" value="1" /> |
||||||
|
</component> |
||||||
|
<component name="debuggerHistoryManager"> |
||||||
|
<expressions id="evaluateExpression"> |
||||||
|
<expression> |
||||||
|
<expression-string>RfM1Authentication2</expression-string> |
||||||
|
<language-id>go</language-id> |
||||||
|
<evaluation-mode>EXPRESSION</evaluation-mode> |
||||||
|
</expression> |
||||||
|
</expressions> |
||||||
|
</component> |
||||||
|
<component name="editorHistoryManager"> |
||||||
|
<entry file="file://$PROJECT_DIR$/../sl500-api/sl500_test.go"> |
||||||
|
<provider selected="true" editor-type-id="text-editor"> |
||||||
|
<state relative-caret-position="442"> |
||||||
|
<caret line="26" column="38" selection-start-line="26" selection-start-column="30" selection-end-line="26" selection-end-column="38" /> |
||||||
|
<folding> |
||||||
|
<element signature="e#24#84#0" expanded="true" /> |
||||||
|
</folding> |
||||||
|
</state> |
||||||
|
</provider> |
||||||
|
</entry> |
||||||
|
<entry file="file://$PROJECT_DIR$/serve.go"> |
||||||
|
<provider selected="true" editor-type-id="text-editor"> |
||||||
|
<state relative-caret-position="102"> |
||||||
|
<caret line="6" column="1" selection-start-line="6" selection-start-column="1" selection-end-line="6" selection-end-column="1" /> |
||||||
|
<folding> |
||||||
|
<element signature="e#14#64#0" expanded="true" /> |
||||||
|
</folding> |
||||||
|
</state> |
||||||
|
</provider> |
||||||
|
</entry> |
||||||
|
<entry file="file://$PROJECT_DIR$/../sl500-api/sl500.go"> |
||||||
|
<provider selected="true" editor-type-id="text-editor"> |
||||||
|
<state relative-caret-position="204"> |
||||||
|
<caret line="32" column="7" selection-start-line="32" selection-start-column="7" selection-end-line="32" selection-end-column="7" /> |
||||||
|
<folding> |
||||||
|
<element signature="e#19#109#0" expanded="true" /> |
||||||
|
</folding> |
||||||
|
</state> |
||||||
|
</provider> |
||||||
|
</entry> |
||||||
|
</component> |
||||||
|
</project> |
@ -0,0 +1,69 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"git.tomans.ru/Tomansru/sl500-api" |
||||||
|
"log" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
log.SetFlags(log.LstdFlags | log.Lmicroseconds) |
||||||
|
|
||||||
|
reader, err := sl500_api.NewConnection("COM5", sl500_api.Baud.Baud19200, false) |
||||||
|
if err != nil { |
||||||
|
log.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
|
_, _ = reader.RfLight(sl500_api.ColorOff) |
||||||
|
|
||||||
|
_, err = reader.RfAntennaSta(sl500_api.AntennaOn) |
||||||
|
if err != nil { |
||||||
|
log.Fatal(err) |
||||||
|
} |
||||||
|
|
||||||
|
_, _ = reader.RfLight(sl500_api.ColorRed) |
||||||
|
|
||||||
|
ch := time.Tick(100 * time.Millisecond) |
||||||
|
|
||||||
|
var resp, cardId, cardCapacity, blockData []byte |
||||||
|
|
||||||
|
for range ch { |
||||||
|
// Get card type and detect card
|
||||||
|
resp, _ = reader.RfRequest(sl500_api.RequestAll) |
||||||
|
if len(resp) != 2 { |
||||||
|
_, _ = reader.RfLight(sl500_api.ColorRed) |
||||||
|
log.Printf("[ERROR 1]: Wrong length for rf request %v\n", resp) |
||||||
|
continue |
||||||
|
} |
||||||
|
|
||||||
|
// Anti collision check and get card capacity
|
||||||
|
cardId, _ = reader.RfAnticoll() |
||||||
|
cardCapacity, _ = reader.RfSelect(cardId) |
||||||
|
if len(cardCapacity) == 0 { |
||||||
|
log.Printf("[ERROR 2]: Capacity length is wrong %v\n", cardCapacity) |
||||||
|
continue |
||||||
|
} |
||||||
|
|
||||||
|
// Set Authentication
|
||||||
|
_, err = reader.RfM1Authentication2(sl500_api.AuthModeKeyA, 28, []byte{0x6a, 0xa9, 0xd7, 0x71, 0x3e, 0xb3}) |
||||||
|
if err != nil { |
||||||
|
log.Println("[ERROR 3]:", err) |
||||||
|
continue |
||||||
|
} |
||||||
|
|
||||||
|
// Get Data
|
||||||
|
blockData, err = reader.RfM1Read(28) |
||||||
|
if err != nil { |
||||||
|
log.Println("[ERROR 4]:", err) |
||||||
|
continue |
||||||
|
} |
||||||
|
if len(blockData) != 16 { |
||||||
|
log.Printf("[ERROR 5]: Wrong block data length %v\n", blockData) |
||||||
|
continue |
||||||
|
} |
||||||
|
|
||||||
|
_, _ = reader.RfLight(sl500_api.ColorGreen) |
||||||
|
//_, _ = reader.RfBeep(30)
|
||||||
|
log.Printf("% x\n", blockData) |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue