Skip to content

Commit

Permalink
feat : Update Device Preference example
Browse files Browse the repository at this point in the history
Signed-off-by: stdk-scm <[email protected]>
  • Loading branch information
stdk-scm committed May 10, 2023
1 parent e2188c7 commit f5c7726
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion apps/esp32/light_example/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,23 @@ static void iot_noti_cb(iot_noti_data_t *noti_data, void *noti_usr_data)
} else if (noti_data->type == IOT_NOTI_TYPE_RATE_LIMIT) {
printf("[rate limit] Remaining time:%d, sequence number:%d\n",
noti_data->raw.rate_limit.remainingTime, noti_data->raw.rate_limit.sequenceNumber);
}
} else if(noti_data->type == IOT_NOTI_TYPE_PREFERENCE_UPDATED) {
for (int i = 0; i < noti_data->raw.preferences.preferences_num; i++) {
printf("[preference update] name : %s value : ", noti_data->raw.preferences.preferences_data[i].preference_name);
if (noti_data->raw.preferences.preferences_data[i].preference_data.type == IOT_CAP_VAL_TYPE_NULL)
printf("NULL\n");
else if (noti_data->raw.preferences.preferences_data[i].preference_data.type == IOT_CAP_VAL_TYPE_STRING)
printf("%s\n", noti_data->raw.preferences.preferences_data[i].preference_data.string);
else if (noti_data->raw.preferences.preferences_data[i].preference_data.type == IOT_CAP_VAL_TYPE_NUMBER)
printf("%f\n", noti_data->raw.preferences.preferences_data[i].preference_data.number);
else if (noti_data->raw.preferences.preferences_data[i].preference_data.type == IOT_CAP_VAL_TYPE_INTEGER)
printf("%d\n", noti_data->raw.preferences.preferences_data[i].preference_data.integer);
else if (noti_data->raw.preferences.preferences_data[i].preference_data.type == IOT_CAP_VAL_TYPE_BOOLEAN)
printf("%s\n", noti_data->raw.preferences.preferences_data[i].preference_data.boolean ? "true" : "false");
else
printf("Unknown type\n");
}
}
}

void button_event(IOT_CAP_HANDLE *handle, int type, int count)
Expand Down
2 changes: 1 addition & 1 deletion iot-core
Submodule iot-core updated 83 files
+16 −27 README.md
+5 −0 doc/Commercialization_Guide
+354 −0 doc/getting_started.md
+ doc/res/add-product-info.gif
+ doc/res/add_device1.png
+ doc/res/add_device2.png
+ doc/res/adding_test_device2.png
+ doc/res/create-device-onboarding.gif
+ doc/res/create-device-profile.gif
+ doc/res/create-project.gif
+ doc/res/deploy_to_test_switch.png
+ doc/res/developer_mode.png
+ doc/res/device_control1.png
+ doc/res/device_control2.png
+ doc/res/downloading_onboarding_config_file_switch.png
+ doc/res/register-test-device.gif
+ doc/res/sign_in.png
+18 −3 example/esp32/README.md
+8 −0 example/esp32/custom_partitions.csv
+0 −0 example/esp32/main/device_control.c
+0 −0 example/esp32/main/device_control.h
+0 −0 example/esp32/main/iot_cli_cmd.c
+0 −0 example/esp32/main/iot_cli_cmd.h
+0 −0 example/esp32/main/iot_uart_cli.c
+0 −0 example/esp32/main/iot_uart_cli.h
+17 −1 example/esp32/main/main.c
+7 −7 example/esp32/sdkconfig
+0 −1,735 example/esp32/sdkconfig.old
+18 −0 example/posix/CMakeLists.txt
+0 −26 example/posix/Makefile
+26 −0 example/posix/README.md
+39 −0 example/posix/stdkconfig.cmake
+18 −0 example/raspberry/CMakeLists.txt
+40 −0 example/raspberry/README.md
+8 −0 example/raspberry/device_info.json
+185 −0 example/raspberry/example.c
+16 −0 example/raspberry/onboarding_config.json
+39 −0 example/raspberry/stdkconfig.cmake
+1 −1 src/CMakeLists.txt
+3 −0 src/component.cmake
+5 −0 src/easysetup/CMakeLists.txt
+5 −0 src/easysetup/ble/easysetup_ble.h
+8 −16 src/easysetup/ble/iot_easysetup_ble.c
+198 −275 src/easysetup/ble/iot_easysetup_ble_ecdh.c
+2 −2 src/easysetup/ble/iot_easysetup_ble_msg.c
+3 −2 src/easysetup/ble/iot_easysetup_ble_parser.c
+12 −5 src/easysetup/ble/iot_easysetup_ble_task.c
+18 −26 src/easysetup/ble/iot_easysetup_d2d_ble.c
+81 −0 src/easysetup/discovery/advertiser/iot_easysetup_discovery_advertiser.c
+168 −2 src/easysetup/iot_easysetup_st_mqtt.c
+64 −0 src/include/bsp/iot_bsp_ble.h
+22 −0 src/include/bsp/linux/iot_bsp_custom.h
+1 −0 src/include/iot_capability.h
+12 −0 src/include/iot_easysetup.h
+12 −0 src/include/iot_internal.h
+12 −0 src/include/iot_main.h
+12 −0 src/include/iot_nv_data.h
+3 −0 src/include/iot_wt.h
+4 −0 src/include/security/backend/iot_security_be.h
+7 −0 src/include/security/iot_security_common.h
+11 −0 src/include/security/iot_security_crypto.h
+15 −0 src/include/st_dev.h
+1 −1 src/include/st_dev_version.h
+18 −0 src/iot_api.c
+64 −1 src/iot_capability.c
+40 −0 src/iot_main.c
+121 −0 src/iot_nv_data.c
+125 −2 src/iot_wt.c
+8 −1 src/port/bsp/esp32/CMakeLists.txt
+530 −0 src/port/bsp/esp32/iot_bsp_ble_esp32.c
+6 −0 src/port/bsp/esp32/iot_bsp_wifi_esp32.c
+19 −0 src/port/bsp/linux/CMakeLists.txt
+92 −0 src/port/bsp/linux/iot_bsp_debug_linux.c
+133 −0 src/port/bsp/linux/iot_bsp_fs_linux.c
+76 −0 src/port/bsp/linux/iot_bsp_nv_data_linux.c
+39 −0 src/port/bsp/linux/iot_bsp_random_linux.c
+102 −0 src/port/bsp/linux/iot_bsp_system_linux.c
+269 −0 src/port/bsp/linux/iot_bsp_wifi_linux.c
+1,069 −0 src/port/bsp/linux/wifi_supplicant.c
+66 −0 src/port/bsp/linux/wifi_supplicant.h
+3 −1 src/port/bsp/posix/CMakeLists.txt
+45 −18 src/security/backend/software/iot_security_be_software.c
+24 −0 src/security/iot_security_crypto.c

0 comments on commit f5c7726

Please sign in to comment.