golioth / reference-design-template

Template for making new Golioth Reference Design repositories
Apache License 2.0
17 stars 5 forks source link

get_network_rpc call gives error and only returns half of the data due to fixed RPC_MAX_RESPONSE_LEN #87

Closed jstuewe23 closed 5 months ago

jstuewe23 commented 6 months ago

When issuing the "get_network_rpc" call the web console reports RPC_OK, but only half of the modem information is present. The serial console reports the erorr: "[00:00:26.351,806] net_info: Failed to encode value"

Here is the data returned, but it's only about half of what is is supposed to return.

Details (JSON)
{
"Cell ID of the device":"0C83A710"
"Current LTE band":"12"
"Current mode":"2"
"Current operator name":"310410"
"Signal strength":"52"
"Supported LTE bands":"(1,2,3,4,5,8,12,13,18,19,20,25,26,28,66)"
"Tracking area code":"7009"
}

I have my own custom code that got a "Failed to encode value" with SDK 0.10.0 and 0.11.0 so I reproduced it here to report it.

It's likely due to to the de-featuring of CONFIG_GOLIOTH_RPC_MAX_RESPONSE_LEN which was set to 512 in the SDK7 template but is removed from SDK10 & 11 SDK7
grep -inr "uint8_t response_buf" deps/modules/lib/golioth/net/golioth/rpc.c:175: uint8_t response_buf[CONFIG_GOLIOTH_RPC_MAX_RESPONSE_LEN]; SDK11
grep -inr "uint8_t response_buf" deps/modules/lib/golioth-firmware-sdk/src/rpc.c:124: uint8_t response_buf[256];

I need a way to configure longer RPC response packets like the one used in this template.

szczys commented 5 months ago

Thanks for reporting. I'm seeing the same behavior and have confirmed it's due to an array size set in the SDK. We're looking into this and will report back when we have a solution planned.

szczys commented 5 months ago

Hi @jstuewe23, good news on this issue. We cut release v0.11.1 of the Golioth Firmware SDK yesterday that includes support for settings the RPC return length. You can see the change here: https://github.com/golioth/golioth-firmware-sdk/pull/407

I've opened a PR in this repository that will add the change to the Reference Design Template once merged. Thanks again for reporting this issue!