CANGenPlugin generates CAN frames for CANSimPlugin based on WebSocket Simulator API requests.
More...
CANGenPlugin generates CAN frames for CANSimPlugin based on WebSocket Simulator API requests.
CANGenPlugin is a source plug-in for Automotive message broker(AMB).
For the AMB library API please visit Automotive message broker web page.
To load this plugin at AMB starup, insert following rows into AMB configuration file:
{
"name" : "CANGenPlugin",
"path":"/usr/lib/automotive-message-broker/cangenplugin.so"
}
It supports following Simulator API commands:
- Simulator.get() - Get property request - JSON in the form:
{"type":"method","name":"get","transactionid":"862bb93d-a302-9a58-baa9-d90265ac843c","data":[{"property":"VehicleSpeed","zone":"0"}]}
CANGenPlugin replies to this command with actual value, timestamp and sequence number of the requested property with the JSON in the form:
{"type":"methodReply","name":"get","data":{"property":"VehicleSpeed","zone":"0","value":"35","timestamp":"1388656508.34255","sequence": "2"},"transactionid":"862bb93d-a302-9a58-baa9-d90265ac843c"}
- Simulator.set() - Set property request(simulation of the property new value) - JSON in the form:
{"type":"method","name":"set","transactionid":"d5935c94-7b05-fd67-56bc-31c320185035","data":[{"interface":"vcan0","property":"VehicleSpeed","value":"33","zone":"0"}]}
Based on property name and zone CANGenPlugin finds corresponding CAN Id of the requested property, builds CAN frame and sends it via specified CAN interface in the host OS.
I replies back to the Simulator with the operation error code on failure or without error code on success:
{"type":"methodReply","name":"set","data":[{"property":"VehicleSpeed"}],"transactionid":"d5935c94-7b05-fd67-56bc-31c320185035","error":"method call failed"}
{"type":"methodReply","name":"set","data":[{"property":"VehicleSpeed"}],"transactionid":"d5935c94-7b05-fd67-56bc-31c320185035"}