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

Twin Implementation #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Twin Implementation #18

wants to merge 3 commits into from

Conversation

sw-iot-neeravparasar
Copy link

@sw-iot-neeravparasar sw-iot-neeravparasar commented Jan 1, 2024

  • [scripts/setup-iotc-c-lib.sh ]

    git clone --depth 1 --branch iotc-c-lib-patch https://github.com/avnet-iotconnect/iotc-c-lib.git
    added git clone repo along with change in branch as it has the wrong url as well

  • [**iotconnect_event.h ** ] Twin Update
    Declare the twin callback and process the iotcl_process_twin_event().
    [iotc-c-lib-patch](avnet-iotconnect/iotc-c-lib@55faa28)

  • [ iotconnect_event.c] Twin Update
    Defined the twin callback and processed the iotcl_process_twin_event() for reporting the value.
    [iotc-c-lib-patch](avnet-iotconnect/iotc-c-lib@55faa28)

  • [samples/iotc-sensors-gps/src/main.c & samples/iotc-basic/src/main.c ]
    Added Twin update callback
    config->twin_msg_cb = on_twin_command;
    static void on_twin_command(IotclEventData payload)

  • [ otconnect-sdk/src/iotconnect.c]
    Added Twin static topic requires update and report the twin value
    at defined iotc_twin_mqtt_data() where SDK will receive the twin payload.
    iotconnect_update_twin() method to report the updated value coming from firmware.

  • [ iotconnect-sdk/include/iotconnect.h]
    Declare twin call back in IotconnectClientConfig structure.

  • [iotconnect-sdk/nrf-layer-lib/src/iotconnect_mqtt.c ]
    Along with the event topic twin payload is going to be identified

  • [iotconnect-sdk/nrf-layer-lib/include/iotconnect_mqtt.h ]
    Declare twin call back under IotconnectMqttConfig structure.

@imran Please take a look at the changes.

typedef struct {
char *env; // Environment name. Contact your representative for details.
char *cpid; // Settings -> Company Profile.
char *duid; // Name of the device.
IotclOtaCallback ota_cb; // callback for OTA events.
IotclCommandCallback cmd_cb; // callback for command events.
IotcltwinrecivCallback twin_msg_rciv;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the same naming conventions as the other callback be followed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2e1de91

updated in the above latest commit.

printk("Error: no mqtt data_cb configured\n");
printk("Error: no mqtt data_cb configured\n");
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be properly indented to avoid confusion of the double braces back to back.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2e1de91

updated in the above latest commit.

@@ -19,7 +19,7 @@
#include "led_pwm.h"
#else
#define ui_leds_init()
#define ui_led_set_rgb(a,b,c) (void) (a,b,c)
#define ui_led_set_rgb(a,b,c)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are the void statements removed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2e1de91

updated in the above latest commit.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#define ui_led_set_rgb(a,b,c) was left since i used it from releases https://github.com/avnet-iotconnect/iotc-nrf-sdk/releases/tag/v2.0.0 "v2.0.0".

Copy link

@krantik krantik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check the variable name casing some of the new ones start with capital etc.,

@sw-iot-neeravparasar
Copy link
Author

@sw-ms-imranbhadelia Could you please take up the review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants