From 35de52f34bfabc41f10d595f636ea5f501ba1150 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 4 Dec 2016 13:54:31 +0100 Subject: Initial import --- protocol.go | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 protocol.go (limited to 'protocol.go') diff --git a/protocol.go b/protocol.go new file mode 100644 index 0000000..3f3c05f --- /dev/null +++ b/protocol.go @@ -0,0 +1,111 @@ +package anki + +const ( + // BLE Connection + VehicleMsgC2VDisconnect = 0x0d + + // Ping request / response + VehicleMsgC2VPingRequest = 0x16 + VehicleMsgV2CPingResponse = 0x17 + + // Messages for checking vehicle version info + VehicleMsgC2VVersionRequest = 0x18 + VehicleMsgV2CVersionResponse = 0x19 + + // Baterry level + VehicleMsgC2VBatteryLevelRequest = 0x1a + VehicleMsgV2CBatteryLevelResponse = 0x1b + + // Lights + VehicleMsgC2VSetLights = 0x1d + + // Driving Commands + VehicleMsgC2VSetSpeed = 0x24 + VehicleMsgC2VChangeLane = 0x25 + VehicleMsgC2VCancelLaneChange = 0x26 + VehicleMsgC2VTurn = 0x32 + + // Vehicle position updates + VehicleMsgV2CLocalizationPositionUpdate = 0x27 + VehcileMsgV2CLocalizationTransitionUpdate = 0x29 + VehicleMsgV2CLocalizationIntersectionUpdate = 0x2a + VehicleMsgV2cVehicleDelocalized = 0x2b + VehicleMsgC2VSetOffsetFromRoadCenter = 0x2c + VehicleMsgV2COffsetFromRoadCenterUpdate = 0x2d + + // Light Patterns + VehicleMsgC2VLightsPattern = 0x33 + + // Vehicle Configuration Prameters + VehicleMsgC2VSetConfigParams = 0x45 + + // SDK Mode + VehicleMsgC2VSDKMode = 0x90 +) + +const ( + VehicleTurnNone = iota + VehicleTurnLeft + VehicleTurnRight + VehicleTurnUTurn + VehicleTurnUTurnJump +) + +const ( + VehcileTurnTriggerImmediate = iota // Run immediately + VehicleTurnTriggerIntersection // Run at the next intersection +) + +const ( + Forward = iota + Reverse +) + +const ( + IntersectionCodeEntryFirst = iota + IntersectionCodeExitFirst + IntersectionCodeEntrySecond + IntersectionCodeExitSecond +) + +// Lights +// The bits in the simple light message corresponding to each type of light +const ( + LightHeadlights = 1 << iota + LightBrakelights + LightFrontlights + LightEngine +) + +const ( + VehcileMaxLightIntensity = 14 + VehicleMaxLightTime = 11 +) + +// LED channel definitions - for RGB engine, front, and tail lights +const ( + LightRed = iota + LightTail + LightBlue + LightGreen + LightFrontL + LightFrontR +) + +const ( + EffectSteady = iota // Simply set the light intensity to 'start' value + EffectFade // Fade intensity from 'start' to 'end' + EffectThrob // Fade intensity from 'start' to 'end' and back to 'start' + EffectFlash // Tun on LED between time 'start' and time 'end' inclusive + EffectRandom // Flash the LED erratically - ignoring start/end +) + +const ( + TrackMaterialPlastic = iota + TrackMaterialVinyl +) + +const ( + SupercodeNone = iota + SupercodeBoostJump +) -- cgit v1.2.3