Closed prasadtiru closed 3 years ago
We need a mechanism to publish a version for each of the Gateways. The move from org.arl.unet.Parameters
to org.arl.fjage.param.Parameters
is a breaking change. If we can keep and publish a version of the gateway at least we know which version works with which version of UnetStack.
Good idea. We should be able to figure it out based on existence of a class by attempting a simple op when we open the connection. Example:
On opening the connection, gateway sends:
{"alive": true}
{"action":"send","message":{"clazz":"org.arl.fjage.param.ParameterReq","data":{"msgID":"abracadabra","perf":"REQUEST","recipient":"#gw-abc","sender":"gw-abc"}},"relay":true}
on latest fjåge, we get back a response:
"action":"send","message":{"clazz":"org.arl.fjage.param.ParameterReq","data":{"index":-1,"requests":null,"param":null,"value":null,"msgID":"abracadabra","perf":"REQUEST","recipient":"#gw-abc","sender":"gw-abc","inReplyTo":null,"sentAt":1606812383816}},"relay":false}
Whereas, on old fjåge (before parameters were added), we should get back:
{"action":"send","message":{"clazz":"org.arl.fjage.Message","data":{"msgID":"abracadabra","perf":"REQUEST","recipient":"#gw-abc","sender":"gw-abc","inReplyTo":null,"sentAt":1606812422731}},"relay":false}
since the class org.arl.fjage.param.ParameterReq
is not known on the master.
@mchitre @prasadtiru Shall we add this👆🏾 logic to all fjåge Gateways?
To make it less messy, we can do this the first time a ParameterReq is sent by any Gateway.
Thought?
Added the capability to automatically figure out which param message class to use while opening a connection. Tested this with both the older fjage version and newer fjage version and it works fine.
ParameterReq
when connection is opened to get phy.version
using the new version of message class org.arl.fjage.param.ParameterReq
Performative.INFORM
when it understands this versus Performative.NOT_UNDERSTOOD
when it does not understand.Below are the results :
>test/test_unet localhost localhost 1101 1102
unetsocket_open_tx: PASSED
unetsocket_open_rx: PASSED
Range measured is : 999.700012
Ranging: PASSED
unetsocket_send: PASSED
unetsocket_bind: PASSED
unetsocket_unbind: PASSED
unetsocket_is_bound: PASSED
unetsocket_get_local_protocol: PASSED
unetsocket_get_local_address: PASSED
unetsocket_connect: PASSED
unetsocket_is_connected: PASSED
unetsocket_get_remote_address: PASSED
unetsocket_get_local_protocol: PASSED
unetsocket_disconnect 1: PASSED
unetsocket_disconnect 2: PASSED
unetsocket_set_timeout: PASSED
unetsocket_get_timeout: PASSED
unetsocket_receive: PASSED
Power level: PASSED
Get integer parameter: PASSED
Set integer parameter: PASSED
Get float parameter: PASSED
Set float parameter: PASSED
Get bool parameter: PASSED
Set bool parameter: PASSED
Get string parameter: PASSED
Set string parameter: PASSED
unetsocket_close_tx: PASSED
unetsocket_close_rx: PASSED
unetsocket_is_closed: PASSED
*** 30 test(s) PASSED, 0 test(s) FAILED ***
>test/test_unet localhost localhost 1101 1102
unetsocket_open_tx: PASSED
unetsocket_open_rx: PASSED
Range measured is : 999.999756
Ranging: PASSED
unetsocket_send: PASSED
unetsocket_bind: PASSED
unetsocket_unbind: PASSED
unetsocket_is_bound: PASSED
unetsocket_get_local_protocol: PASSED
unetsocket_get_local_address: PASSED
unetsocket_connect: PASSED
unetsocket_is_connected: PASSED
unetsocket_get_remote_address: PASSED
unetsocket_get_local_protocol: PASSED
unetsocket_disconnect 1: PASSED
unetsocket_disconnect 2: PASSED
unetsocket_set_timeout: PASSED
unetsocket_get_timeout: PASSED
unetsocket_receive: PASSED
Power level: PASSED
Get integer parameter: PASSED
Set integer parameter: PASSED
Get float parameter: PASSED
Set float parameter: PASSED
Get bool parameter: PASSED
Set bool parameter: PASSED
Get string parameter: PASSED
Set string parameter: PASSED
unetsocket_close_tx: PASSED
unetsocket_close_rx: PASSED
unetsocket_is_closed: PASSED
*** 30 test(s) PASSED, 0 test(s) FAILED ***
Added the APIs and the corresponding test code to support setting and getting parameters.