P6 Deployable Jar
Basic Usage
The basic command line usage of this jar is simple. Running the jar with the --help
setting will display some basic information and examples for usage. It outlines the 4 arguments that can be used:
Argument | Input Format | Description |
---|---|---|
--help | Displays the help information | |
--date | YYYY-MM-DD | Current date is the default |
--direction | MO or MT | The direction of the message. If the message is given the wrong direction you will see ERROR_PAYLOAD_INVALID. MO is default. |
--encode | JSON String | The MO or MT message only, not to include the wrapper message e.g. MO_MESSAGE_ALERT_GENERIC |
--decode | Hexadecimal | Only the payload content to be decoded (message field within a Lingo message) |
--key | Hexadecimal | The encryption key |
Decoding Example
To decode a payload, simply use the --decode
flag with the payload. Optionally include a date and direction if applicable.
java -jar p6.jar --direction MO --date 2024-03-04 --decode 06120000000000000AA53C4000000007E037001F00
When decoded it will be wrapped in a higher level object P6DecodingResponse
which includes a status and errors as a result of decoding. The messages field is then populated with the decoded results. The example below shows the MO message for MO_MESSAGE_ALERT_GENERIC
as decoded by the command above.
{
"status": true,
"error": [],
"messages": [{
"mo": {
"encrypted": false,
"alertStatus": false,
"powerStatus": false,
"watchStatus": false,
"type": "MO_MESSAGE_ALERT_GENERIC",
"genericAlert": {
"position": {
"standard": {
"at": {
"year": 2024,
"month": 8,
"day": 24,
"hour": 12,
"minute": 6,
"second": 43
},
"timeDelta": 43603,
"dayOfYear": 55,
"latlng": {
"latitude": -90.0,
"longitude": -180.0
},
"altitude": 0,
"course": 0,
"speed": 0.0,
"navigationMode": "NAVIGATION_MODE_2D",
"battery": 98,
"pdop": 0.0,
"temperature": 23
}
},
"eventId": "ALERT_EVENT_BUTTON_ALERT_CANCEL",
"deltaTime": 0,
"at": {
"year": 2024,
"month": 8,
"day": 24,
"hour": 12,
"minute": 6,
"second": 43
}
}
}
}]
}
Encoding Example
To encode a message, use the --encode
flag with the optional date and direction flags as required. When encoding, the message must be passed in at the individual message level.
Consider the following example:
java -jar p6.jar --encode "{
"encrypted": false,
"alertStatus": false,
"powerStatus": false,
"watchStatus": false,
"type": "MO_MESSAGE_ALERT_GENERIC",
"genericAlert": {
"position": {
"standard": {
"at": {
"year": 2024,
"month": 8,
"day": 24,
"hour": 12,
"minute": 6,
"second": 43
},
"timeDelta": 43603,
"dayOfYear": 55,
"latlng": {
"latitude": -90.0,
"longitude": -180.0
},
"altitude": 0,
"course": 0,
"speed": 0.0,
"navigationMode": "NAVIGATION_MODE_2D",
"battery": 98,
"pdop": 0.0,
"temperature": 23
}
},
"eventId": "ALERT_EVENT_BUTTON_ALERT_CANCEL",
"deltaTime": 0,
"at": {
"year": 2024,
"month": 8,
"day": 24,
"hour": 12,
"minute": 6,
"second": 43
}
}
}"
This results in the hexadecimal below.
06120000000000000AA53C4000040007E037001F00
Encryption
The jar also has the capability to handle encryption. An encryption key can be provided with the --key
flag and will be used in both decoding encrypted
messages and encoding json messages.
--key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Encrypt
To encrypt the encoded json, simply add the --key
to the arguments with the normal process.
java -jar p6.jar --encode "{
"encrypted": true,
"alertStatus": false,
"powerStatus": true,
"watchStatus": false,
"type": "MO_MESSAGE_DEACTIVATION_NO_FIX",
"alert": {
"type": "EVENT_DEACTIVATION",
"position": {
"no": {
"at": {
"year": 2024,
"month": 8,
"day": 27,
"hour": 18,
"minute": 23,
"second": 40},
"timeDelta": 66220,
"dayOfYear": 58,
"battery": 50,
"temperature": -26
}
}
}
}"
--key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This will generate the output as usual
A66EEFF7B6F2FDEB63E7C64487F6E882811C7E4FFC80BA
Decrypt
To decrypt it is the same process again, passing in the --key
with your request.
java -jar p6.jar --decode a6b55fdc74d0b1cf2f80c4fbe42b701d3edd1d6fbe447fc86cab66e3215e39f4a9162f --key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX