Skip to content
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

Setting float arrays using fjage C API #210

Closed
prasadtiru opened this issue Jun 18, 2021 · 1 comment
Closed

Setting float arrays using fjage C API #210

prasadtiru opened this issue Jun 18, 2021 · 1 comment
Assignees

Comments

@prasadtiru
Copy link
Contributor

Currently fjage_msg_add_float_array() function is used to set array values in a message. This function does base64 encoding of the array. However, the base64 encoding in the JSON message might be incorrect. Here is an example when trying to set node.location:

The array is base64 encoded in the JSON message that is sent when we set node.location using fjage C APIs shown here:

{
   "action":"send",
   "relay":true,
   "message":{
      "clazz":"org.arl.fjage.param.ParameterReq",
      "data":{
         "msgID":"hpx3MLYv/yzMtIQeIbtPvxxAfXyTe0ExbUWo",
         "perf":"REQUEST",
         "recipient":"node",
         "sender":"CGatewayAgent@000041a7",
         "index":-1,
         "param":"location",
         "value":"AACAPwAAAEAAAEBA"
      }
   }
}

whereas, if I use a groovy shell remotely to set node.location (this works as expected), the JSON message that is sent is

{
   "id":"94b9ea5d-c3bd-4f87-a6fd-6a77665fe075",
   "action":"send",
   "message":{
      "clazz":"org.arl.fjage.param.ParameterReq",
      "data":{
         "index":-1,
         "requests":null,
         "param":"location",
         "value":[
            1.0,
            2.0,
            3.0
         ],
         "msgID":"94b9ea5d-c3bd-4f87-a6fd-6a77665fe075",
         "perf":"REQUEST",
         "recipient":"node",
         "sender":"unetsh#-b7yprc",
         "inReplyTo":null,
         "sentAt":1623986170855
      }
   },
   "relay":true
}
@mchitre
Copy link
Member

mchitre commented Jul 6, 2021

The encoding was not incorrect, as we do allow bare base64 array encoding in the specifications (although we configure the Java end to always include class information).

Added 2 fixes to improve compatibility though:
bbb3691 -- to handle non-b64 encoded arrays in C gateway (was a bug)
c6a3b8d -- to include clazz information in b64 encoded arrays from C gateway (enhancement)

@mchitre mchitre closed this as completed Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants