-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Coap support #2
Comments
Hi @michalboronski, Client and device start by synchronizing their message ids. The client sends a coap POST with the client message id to /sys/dev/sync, the device responds with the devicemessage id. A message id is a 32-bit, 8-hexdigit (uppercase) value and is probably used to detect packages that are received out of sequence (this is udp after all). The device seems to start with a random or time-based value, the client is free to chose whatever he wants. Before each message is sent, the sender increments his message id, where 0xFFFFFFFF+1 simply wraps to 0x00000000. A message is a variable-length, hexdigit, uppercase string, consisting of the 8-digit message id, the encrypted content and a sha-256 checksum of both. Encryption is done using AES/CBC/PKCS7Padding (for Oracle/OpenJDK you have to use AES/CBC/PKCS5Padding though). For the encryption key an MD5 of the string "JiangPan" plus the hexadecimal message id (as UTF-8) is calculated and converted to 32 uppercase hexdigits (again, as UTF-8). The first 16 bytes is the encryption key, the second 16 bytes is the IV. To receive status information, the client sends a coap OBSERVE to /sys/dev/status. The device will then continue to send status messages to the client for as long as the client acknowledges them (this happens automatically for Eclipse Californium). My AC3829/10 sends a status message every 1-3 seconds with longer pauses when udp packages need to be retransmitted, but this seems to vary between devices. Some people in the forum reported to receive only one status message during the ten seconds the sampe program runs. The device sends status messages even when powered off. To issue a command to the device, the following string needs to be sent as a message using coap POST to /sys/dev/control:
where When the command failed the response is I hope this helps. Good luck! :-)
|
No description provided.
The text was updated successfully, but these errors were encountered: