- My goal is: Update config from google cloud IoT
- My actions are: I have next code
static void my_gcp_ev_handler(int ev, void *evd, void *arg)
{
if (ev == MGOS_GCP_EV_CONFIG)
{
LOG(LL_INFO, ("MGOS_GCP_EV_CONFIG"));
struct mgos_gcp_config_arg *msg= (struct mgos_gcp_config_arg *) arg;
struct mg_str *s = &msg->value;
LOG_(LL_INFO, ("got command: [%.*s]", (int) s->len, s->p));
(void)evd;
(void)arg;
}
enum mgos_app_init_result mgos_app_init(void)
{
mgos_event_add_group_handler(MGOS_GCP_EV_BASE, my_gcp_ev_handler, NULL);
return MGOS_APP_INIT_SUCCESS;
}
- The result I see is: fatal error
[May 9 16:17:02.405] mgos_mqtt_conn.c:231 MQTT0 TCP connect ok (0)
[May 9 16:17:02.790] mgos_mqtt_conn.c:275 MQTT0 CONNACK 0
[May 9 16:17:02.806] mgos_mqtt_conn.c:212 MQTT0 sub /devices/CO2_METER_119EB4/commands/# @ 1
[May 9 16:17:02.806] mgos_mqtt_conn.c:212 MQTT0 sub /devices/CO2_METER_119EB4/config @ 1
[May 9 16:17:02.886] main.c:128 MGOS_GCP_EV_CONFIG
[May 9 16:17:02.886]
[May 9 16:17:02.886] Exception 28 @ 0x402a5002, vaddr 0x00000004
[May 9 16:17:02.886] A0: 0x402a4ffc A1: 0x3ffffce0 A2: 0x402043d1 A3: 0x00000000
[May 9 16:17:02.886] A4: 0x00000000 A5: 0x00000018 A6: 0x00000001 A7: 0x00000001
[May 9 16:17:02.902] A8: 0x00000000 A9: 0x00000018 A10: 0x00000001 A11: 0x20202020
[May 9 16:17:02.902] A12: 0x00000000 A13: 0x3fff20bc A14: 0x3ffffd20 A15: 0x000000ff
- My expectation & question is: where error in my code? Anybody have example of work with google iot config and command?
struct mgos_gcp_config_arg *msg= (struct mgos_gcp_config_arg *) evd;