moved dispatcher, preparing for sensor data consolidation

This commit is contained in:
Timo Volkmann 2020-11-25 21:20:21 +01:00
parent 77ead4346c
commit 05946c3230
7 changed files with 246 additions and 95 deletions

154
.idea/workspace.xml generated
View File

@ -16,85 +16,19 @@
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="GROUP_NODE:sensor" type="e8cecc67:BranchNodeDescriptor" />
<item name="BRANCH:sensor/relative" type="e8cecc67:BranchNodeDescriptor" />
<item name="BRANCH:timo" type="e8cecc67:BranchNodeDescriptor" />
</path>
</select>
</component>
<component name="ChangeListManager">
<list default="true" id="99c957e4-aa42-481d-843d-3fbc901e0f79" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/cmd/serial_only/serial_only.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/serial_ubx/serial.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ublox/decode.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ublox/messages.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ublox/strings_navpvt.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/server/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/server/server.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/server_only/server_only.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/server_only/server_only.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dispatcher/dispatcher.go" beforeDir="false" afterPath="$PROJECT_DIR$/gnet/dispatcher.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/hyperimu.json" beforeDir="false" afterPath="$PROJECT_DIR$/hyperimu.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/.gitattributes" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/CONTRIBUTING.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/ISSUE_TEMPLATE.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/LICENSE.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/README.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/Theory.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example1_calibrateSensor/Example1_calibrateSensor.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example2_getIMUData/Example2_getIMUData.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example3_getSensorStatus/Example3_getSensorStatus.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Dead Reckoning/Example4_vehicleDynamics/Example4_vehicleDynamics.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example10_AltitudeMSL/Example10_AltitudeMSL.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example11_ResetModule/Example1_FactoryDefaultviaI2C/Example1_FactoryDefaultviaI2C.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example11_ResetModule/Example2_FactoryDefaultsviaSerial/Example2_FactoryDefaultsviaSerial.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example12_UseUart/Example12_UseUart.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example13_PVT/Example2_AutoPVT_ExplicitUpdate/Example2_AutoPVT_ExplicitUpdate.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example13_PVT/Example3_AssumeAutoPVTviaUart/Example3_AssumeAutoPVTviaUart.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example14_DebugOutput/Example14_DebugOutput.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example15_GetDateTime/Example15_GetDateTime.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example16_Nanosecond_MaxOutput/Example16_Nanosecond_MaxOutput.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example16_PartialSecond_MaxOutput/Example16_PartialSecond_MaxOutput.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example17_Geofence/Example17_Geofence.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example18_PowerSaveMode/Example18_PowerSaveMode.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example19_DynamicModel/Example19_DynamicModel.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example1_BasicNMEARead/Example1_BasicNMEARead.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example20_SendCustomCommand/Example20_SendCustomCommand.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example21_ModuleInfo/Example21_ModuleInfo.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example22_PowerOff/Example22_PowerOff.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example2_NMEAParsing/Example2_NMEAParsing.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example3_GetPosition/Example3_GetPosition.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example4_FixType/Example4_FixType.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example5_SpeedHeadingPrecision/Example5_SpeedHeadingPrecision.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example6_EnableNMEASentences/Example6_EnableNMEASentences.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example7_OutputRate/Example7_OutputRate.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example8_GetProtocolVersion/Example8_GetProtocolVersion.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Example9_ChangeI2CAddress/Example9_ChangeI2CAddress.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/NEO-M8P-2/Example1_EnableRTCM/Example1_EnableRTCM.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/NEO-M8P-2/Example2_StartRTCMBase/Example2_StartRTCMBase.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/NEO-M8P-2/Example3_BaseWithLCD/Example3_BaseWithLCD.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7/Example1_GetPositionAndTime_Series_6_7.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7/SparkFun_Ublox_Arduino_Library_Series_6_7.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7/SparkFun_Ublox_Arduino_Library_Series_6_7.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example10_GetHighPrecisionPositionAndAccuracy/Example10_GetHighPrecisionPositionAndAccuracy.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example11_GetHighPrecisionPositionUsingDouble/Example11_GetHighPrecisionPositionUsingDouble.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example11_autoHPPOSLLH/Example11_autoHPPOSLLH.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example11_setStaticPosition/Example11_setStaticPosition.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example1_GetPositionAccuracy/Example1_GetPositionAccuracy.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example2_ValConfigurationMethod/Example2_ValConfigurationMethod.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example3_StartRTCMBase/Example3_StartRTCMBase.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example4_BaseWithLCD/Example4_BaseWithLCD.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example5_RelativePositioningInformation/Example5_RelativePositioningInformation.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example6_GetVal/Example6_GetVal.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example7_SetVal/Example7_SetVal.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example8_GetSetPortSettings/Example8_GetSetPortSettings.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/examples/ZED-F9P/Example9_multiSetVal/Example9_multiSetVal.ino" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/keywords.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/library.properties" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/src/SparkFun_Ublox_Arduino_Library.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/src/SparkFun_Ublox_Arduino_Library.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/SparkFun_Ublox_Arduino_Library/src/u-blox_config_keys.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/serial/serial.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/server/server.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/net/net.go" beforeDir="false" afterPath="$PROJECT_DIR$/gnet/net.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/serial_ubx/serial.go" beforeDir="false" afterPath="$PROJECT_DIR$/serial_ubx/serial.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -139,14 +73,23 @@
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/net" />
<recent name="$PROJECT_DIR$/cmd/server" />
<recent name="$PROJECT_DIR$/serial_ubx" />
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/ublox" />
<recent name="$PROJECT_DIR$/serial" />
</key>
</component>
<component name="RunManager" selected="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/serial_only">
<component name="RunManager" selected="Go Build.go build server.go (1)">
<configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="gyrogpsc" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-i" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="go build git.timovolkmann.de/gyrogpsc/cmd/serial_only" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="gyrogpsc" />
<working_directory value="$PROJECT_DIR$" />
@ -165,6 +108,14 @@
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="go build server.go (1)" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="gyrogpsc" />
<working_directory value="$PROJECT_DIR$" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$/cmd/server/server.go" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="go build server.go" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="gyrogpsc" />
<working_directory value="$PROJECT_DIR$" />
@ -173,13 +124,23 @@
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration default="true" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="gyrogpsc" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-i" />
<framework value="gotest" />
<kind value="DIRECTORY" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Go Build.go build server.go (1)" />
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/cmd/serial_only" />
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/serial" />
<item itemvalue="Go Build.go build server.go" />
<item itemvalue="Go Build.go build server.go" />
<item itemvalue="Go Build.go build git.timovolkmann.de/gyrogpsc/serial" />
</list>
</recent_temporary>
</component>
@ -227,7 +188,14 @@
<option name="project" value="LOCAL" />
<updated>1605444355479</updated>
</task>
<option name="localTasksCounter" value="6" />
<task id="LOCAL-00006" summary="refactored cmd &amp; server">
<created>1606332601566</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1606332601566</updated>
</task>
<option name="localTasksCounter" value="7" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -239,12 +207,17 @@
<entry key="MAIN">
<value>
<State>
<option name="CUSTOM_BOOLEAN_PROPERTIES">
<map>
<entry key="Show.Git.Branches" value="true" />
</map>
</option>
<option name="FILTERS">
<map>
<entry key="branch">
<value>
<list>
<option value="sensor/relative" />
<option value="timo" />
</list>
</value>
</entry>
@ -263,7 +236,8 @@
<MESSAGE value="3d orientation visualization html/css" />
<MESSAGE value="switched to relative sensor data (gyroscope)" />
<MESSAGE value="changed orientation" />
<option name="LAST_COMMIT_MESSAGE" value="changed orientation" />
<MESSAGE value="refactored cmd &amp; server" />
<option name="LAST_COMMIT_MESSAGE" value="refactored cmd &amp; server" />
</component>
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
@ -301,7 +275,7 @@
<screen x="0" y="23" width="1680" height="1027" />
</state>
<state width="1638" height="346" key="GridCell.Tab.-1.right/0.23.1680.1027/0.-1417.2560.1417@0.23.1680.1027" timestamp="1604750445987" />
<state width="1878" height="249" key="GridCell.Tab.0.bottom" timestamp="1606326600270">
<state width="1878" height="406" key="GridCell.Tab.0.bottom" timestamp="1606335310969">
<screen x="0" y="23" width="1920" height="1177" />
</state>
<state width="1638" height="273" key="GridCell.Tab.0.bottom/0.-1417.2560.1417/0.23.1680.1027@0.-1417.2560.1417" timestamp="1604948042531" />
@ -309,9 +283,9 @@
<state width="1638" height="273" key="GridCell.Tab.0.bottom/0.23.1680.1027/0.-1417.2560.1417@0.23.1680.1027" timestamp="1604760252890" />
<state width="1638" height="273" key="GridCell.Tab.0.bottom/0.23.1680.1027@0.23.1680.1027" timestamp="1604933111805" />
<state width="1638" height="273" key="GridCell.Tab.0.bottom/0.23.1920.1116@0.23.1920.1116" timestamp="1605380018474" />
<state width="1878" height="249" key="GridCell.Tab.0.bottom/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606326600270" />
<state width="1878" height="406" key="GridCell.Tab.0.bottom/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606335310969" />
<state width="1638" height="273" key="GridCell.Tab.0.bottom/0.23.1920.1177@0.23.1920.1177" timestamp="1605533225921" />
<state width="1878" height="249" key="GridCell.Tab.0.center" timestamp="1606326600270">
<state width="1878" height="406" key="GridCell.Tab.0.center" timestamp="1606335310968">
<screen x="0" y="23" width="1920" height="1177" />
</state>
<state width="1638" height="273" key="GridCell.Tab.0.center/0.-1417.2560.1417/0.23.1680.1027@0.-1417.2560.1417" timestamp="1604948042530" />
@ -319,9 +293,9 @@
<state width="1638" height="273" key="GridCell.Tab.0.center/0.23.1680.1027/0.-1417.2560.1417@0.23.1680.1027" timestamp="1604760252890" />
<state width="1638" height="273" key="GridCell.Tab.0.center/0.23.1680.1027@0.23.1680.1027" timestamp="1604933111805" />
<state width="1638" height="273" key="GridCell.Tab.0.center/0.23.1920.1116@0.23.1920.1116" timestamp="1605380018473" />
<state width="1878" height="249" key="GridCell.Tab.0.center/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606326600270" />
<state width="1878" height="406" key="GridCell.Tab.0.center/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606335310968" />
<state width="1638" height="273" key="GridCell.Tab.0.center/0.23.1920.1177@0.23.1920.1177" timestamp="1605533225920" />
<state width="1878" height="249" key="GridCell.Tab.0.left" timestamp="1606326600269">
<state width="1878" height="406" key="GridCell.Tab.0.left" timestamp="1606335310967">
<screen x="0" y="23" width="1920" height="1177" />
</state>
<state width="1638" height="273" key="GridCell.Tab.0.left/0.-1417.2560.1417/0.23.1680.1027@0.-1417.2560.1417" timestamp="1604948042530" />
@ -329,9 +303,9 @@
<state width="1638" height="273" key="GridCell.Tab.0.left/0.23.1680.1027/0.-1417.2560.1417@0.23.1680.1027" timestamp="1604760252889" />
<state width="1638" height="273" key="GridCell.Tab.0.left/0.23.1680.1027@0.23.1680.1027" timestamp="1604933111805" />
<state width="1638" height="273" key="GridCell.Tab.0.left/0.23.1920.1116@0.23.1920.1116" timestamp="1605380018472" />
<state width="1878" height="249" key="GridCell.Tab.0.left/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606326600269" />
<state width="1878" height="406" key="GridCell.Tab.0.left/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606335310967" />
<state width="1638" height="273" key="GridCell.Tab.0.left/0.23.1920.1177@0.23.1920.1177" timestamp="1605533225919" />
<state width="1878" height="249" key="GridCell.Tab.0.right" timestamp="1606326600270">
<state width="1878" height="406" key="GridCell.Tab.0.right" timestamp="1606335310968">
<screen x="0" y="23" width="1920" height="1177" />
</state>
<state width="1638" height="273" key="GridCell.Tab.0.right/0.-1417.2560.1417/0.23.1680.1027@0.-1417.2560.1417" timestamp="1604948042531" />
@ -339,7 +313,7 @@
<state width="1638" height="273" key="GridCell.Tab.0.right/0.23.1680.1027/0.-1417.2560.1417@0.23.1680.1027" timestamp="1604760252890" />
<state width="1638" height="273" key="GridCell.Tab.0.right/0.23.1680.1027@0.23.1680.1027" timestamp="1604933111805" />
<state width="1638" height="273" key="GridCell.Tab.0.right/0.23.1920.1116@0.23.1920.1116" timestamp="1605380018473" />
<state width="1878" height="249" key="GridCell.Tab.0.right/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606326600270" />
<state width="1878" height="406" key="GridCell.Tab.0.right/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606335310968" />
<state width="1638" height="273" key="GridCell.Tab.0.right/0.23.1920.1177@0.23.1920.1177" timestamp="1605533225920" />
<state width="1638" height="346" key="GridCell.Tab.1.bottom" timestamp="1604750442086">
<screen x="0" y="23" width="1680" height="1027" />
@ -362,10 +336,18 @@
</state>
<state x="179" y="138" width="1501" height="766" key="SettingsEditor/0.23.1680.1027/0.-1417.2560.1417@0.23.1680.1027" timestamp="1604757277174" />
<state x="204" y="155" key="SettingsEditor/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1605609479939" />
<state x="560" y="351" key="Vcs.Push.Dialog.v2" timestamp="1606332623194">
<screen x="0" y="23" width="1920" height="1177" />
</state>
<state x="560" y="351" key="Vcs.Push.Dialog.v2/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606332623194" />
<state width="840" height="513" key="XDebugger.FullValuePopup" timestamp="1604750505120">
<screen x="0" y="23" width="1680" height="1027" />
</state>
<state width="840" height="513" key="XDebugger.FullValuePopup/0.23.1680.1027/0.-1417.2560.1417@0.23.1680.1027" timestamp="1604750505120" />
<state x="694" y="331" key="git4idea.branch.GitSmartOperationDialog" timestamp="1606335339469">
<screen x="0" y="23" width="1920" height="1177" />
</state>
<state x="694" y="331" key="git4idea.branch.GitSmartOperationDialog/0.23.1920.1177/0.-1417.2560.1417@0.23.1920.1177" timestamp="1606335339469" />
<state x="505" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1604757918385">
<screen x="0" y="23" width="1680" height="1027" />
</state>

View File

@ -1,6 +1,7 @@
package main
import (
<<<<<<< Updated upstream
"encoding/json"
"fmt"
"git.timovolkmann.de/gyrogpsc/dispatcher"
@ -17,6 +18,16 @@ import (
const (
TCP_PORT = ":3010"
SERIAL_PORT = "/dev/tty.usbmodem14201"
=======
"git.timovolkmann.de/gyrogpsc/gnet"
)
const (
TCP_PORT = ":3010"
HTTP_PORT = ":3011"
SERIAL_PORT = "/dev/tty.usbmodem14201"
MAX_WS_DELAY = 20
>>>>>>> Stashed changes
)
var upgrader = websocket.Upgrader{} // use default options
@ -72,7 +83,7 @@ func home(w http.ResponseWriter, r *http.Request) {
}
func main() {
d := dispatcher.New()
d := gnet.NewDispatcher()
collectRoutines(d)
http.HandleFunc("/echo", echo(d))
http.HandleFunc("/", home)
@ -81,7 +92,9 @@ func main() {
log.Fatal(http.ListenAndServe(":3011", nil))
}
func collectRoutines(d *dispatcher.Dispatcher) {
func collectRoutines(d *gnet.Dispatcher) {
// TODO: Hier die Sensordaten zwischenspeichern und per
// collectRoutines Serial UBX Sensor Data
go serialUbxCollector(d)
// collectRoutines TCP JSON Sensor Data

View File

@ -0,0 +1,25 @@
package main
import (
"git.timovolkmann.de/gyrogpsc/gnet"
)
const (
TCP_PORT = ":3010"
HTTP_PORT = ":3011"
SERIAL_PORT = "/dev/tty.usbmodem14201"
MAX_WS_DELAY = 20
)
func main() {
d := gnet.NewDispatcher()
collectRoutines(d)
gnet.NewHttpServer(d, HTTP_PORT)
}
func collectRoutines(d *gnet.Dispatcher) {
// collectRoutines Serial UBX Sensor Data
// go gnet.SerialUbxCollector(d, SERIAL_PORT)
// collectRoutines TCP JSON Sensor Data
go gnet.TcpJsonCollector(d, TCP_PORT)
}

View File

@ -1,4 +1,4 @@
package dispatcher
package gnet
import (
"errors"
@ -10,7 +10,7 @@ type Dispatcher struct {
counter int16
}
func New() *Dispatcher {
func NewDispatcher() *Dispatcher {
fmt.Println("new dispatcher")
return &Dispatcher{
listeners: make(map[int16]chan string),
@ -19,7 +19,7 @@ func New() *Dispatcher {
}
func (d *Dispatcher) Publish(message string) {
fmt.Println("publish to listeners", len(d.listeners))
//fmt.Println("publish to listeners", len(d.listeners))
for _, ch := range d.listeners {
ch <- message
}

131
gnet/net.go Normal file
View File

@ -0,0 +1,131 @@
package gnet
import (
"encoding/json"
"fmt"
"git.timovolkmann.de/gyrogpsc/serial_ubx"
"github.com/gorilla/websocket"
"github.com/tidwall/pretty"
"html/template"
"log"
"net"
"net/http"
"os"
)
func echo(d *Dispatcher) func(w http.ResponseWriter, r *http.Request) {
var upgrader = websocket.Upgrader{} // use default options
return func(w http.ResponseWriter, r *http.Request) {
fmt.Println("upgrading to ws")
c, err := upgrader.Upgrade(w, r, nil)
if err != nil {
log.Print("upgrade:", err)
return
}
//defer c.Close()
go func() {
for {
if _, _, err := c.NextReader(); err != nil {
c.Close()
break
}
}
}()
dispatcherId, channel := d.Subscribe()
defer d.Unsubscribe(dispatcherId)
for {
log.Println("")
//if err != nil {
// log.Println("read:", err)
// break
//}
cmsg := <-channel
err = c.WriteMessage(websocket.TextMessage, []byte(cmsg))
if err != nil {
log.Println("write:", err)
break
}
}
}
}
func home(w http.ResponseWriter, r *http.Request) {
//var homeTemplate = template.Must(template.NewDispatcher("").ParseFiles("index.html"))
tpl, err := template.ParseFiles("index.html")
if err != nil {
log.Fatalln(err)
}
err = tpl.Execute(w, "ws://"+r.Host+"/echo")
if err != nil {
log.Fatalln(err)
}
}
func NewHttpServer(d *Dispatcher, httpPort string) {
http.HandleFunc("/echo", echo(d))
http.HandleFunc("/", home)
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("."))))
log.Fatal(http.ListenAndServe(httpPort, nil))
}
func SerialUbxCollector(d *Dispatcher, serialPort string) {
r, err := serial_ubx.Setup(serialPort)
if err != nil {
log.Fatalln(err)
}
for {
meas, err := r.NextMeasurement()
if err != nil {
continue
}
measjson, err := json.Marshal(meas)
fmt.Println(string(pretty.Pretty(measjson)))
d.Publish(string(measjson))
}
}
func TcpJsonCollector(d *Dispatcher, tcpPort string) {
listener, err := net.Listen("tcp", tcpPort)
if err != nil {
fmt.Println("Error listening:", err.Error())
os.Exit(1)
}
// Close the listener when the application closes.
defer listener.Close()
for {
// Listen for an incoming connection.
conn, err := listener.Accept()
if err != nil {
fmt.Println("Error accepting: ", err.Error())
os.Exit(1)
}
// Handle connections in a new goroutine.
go handleTcpJsonSensorData(conn, d)
}
}
// Handles incoming requests.
func handleTcpJsonSensorData(conn net.Conn, d *Dispatcher) {
defer conn.Close()
// Make a buffer to hold incoming data.
for {
buf := make([]byte, 2048)
// Read the incoming connection into the buffer.
_, err := conn.Read(buf)
if err != nil {
fmt.Println("Error reading:", err.Error())
break
}
json := pretty.Pretty(buf)
fmt.Println(string(json))
d.Publish(string(buf))
// Send a response back to person contacting us.
//conn.Write([]byte("success"))
// Close the connection when you're done with it.
}
}

View File

@ -63,4 +63,4 @@
-0.006618400104343891
],
"tmd3702_proximity proximity sensor": [5, 0, 0]
}
}

View File

@ -61,7 +61,7 @@ func (u *ubxReceiver) NextMeasurement() (*Measurement, error) {
u.currentMeas.Position[0] = v.Lat_dege7
u.currentMeas.Position[1] = v.Lon_dege7
u.currentMeas.Position[2] = v.Height_mm
fmt.Printf("%T %v\n", *v, *v)
//fmt.Printf("%T %v\n", *v, *v)
case *ublox.HnrPvt:
t, err := time.Parse(time.RFC3339Nano, formatTime(v.Year_y, v.Month_month, v.Day_d, v.Hour_h, v.Min_min, v.Sec_s, v.Nano_ns))
if err != nil {
@ -71,12 +71,12 @@ func (u *ubxReceiver) NextMeasurement() (*Measurement, error) {
u.currentMeas.Position[0] = v.Lat_dege7
u.currentMeas.Position[1] = v.Lon_dege7
u.currentMeas.Position[2] = v.Height_mm
fmt.Printf("%T %v\n", *v, *v)
//fmt.Printf("%T %v\n", *v, *v)
case *ublox.NavAtt:
u.currentMeas.Orientation[0] = v.Pitch_deg
u.currentMeas.Orientation[1] = v.Roll_deg
u.currentMeas.Orientation[2] = v.Heading_deg
fmt.Printf("%T %v\n", *v, *v)
//fmt.Printf("%T %v\n", *v, *v)
//case *ublox.RawMessage:
// //fmt.Printf("%T %v\n\n", *v, *v)