├── .github └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── apps ├── .gitignore ├── bl602 │ ├── light_example │ │ ├── Makefile │ │ ├── README.md │ │ ├── light_example │ │ │ ├── bouffalo.mk │ │ │ ├── caps_activityLightingMode.c │ │ │ ├── caps_activityLightingMode.h │ │ │ ├── caps_colorTemperature.c │ │ │ ├── caps_colorTemperature.h │ │ │ ├── caps_dustSensor.c │ │ │ ├── caps_dustSensor.h │ │ │ ├── caps_switch.c │ │ │ ├── caps_switch.h │ │ │ ├── caps_switchLevel.c │ │ │ ├── caps_switchLevel.h │ │ │ ├── device_control.c │ │ │ ├── device_control.h │ │ │ ├── device_info.json │ │ │ ├── main.c │ │ │ └── onboarding_config.json │ │ ├── proj_config.mk │ │ └── sdkconfig.h │ └── switch_example │ │ ├── Makefile │ │ ├── README.md │ │ ├── proj_config.mk │ │ ├── sdkconfig.h │ │ └── switch_example │ │ ├── CMakeLists.txt │ │ ├── bouffalo.mk │ │ ├── caps_switch.c │ │ ├── caps_switch.h │ │ ├── device_control.c │ │ ├── device_control.h │ │ ├── device_info.json │ │ ├── main.c │ │ └── onboarding_config.json ├── capability_sample │ ├── README.md │ ├── caps_accelerationSensor.c │ ├── caps_accelerationSensor.h │ ├── caps_activityLightingMode.c │ ├── caps_activityLightingMode.h │ ├── caps_airQualitySensor.c │ ├── caps_airQualitySensor.h │ ├── caps_alarm.c │ ├── caps_alarm.h │ ├── caps_audioMute.c │ ├── caps_audioMute.h │ ├── caps_audioVolume.c │ ├── caps_audioVolume.h │ ├── caps_battery.c │ ├── caps_battery.h │ ├── caps_bodyMassIndexMeasurement.c │ ├── caps_bodyMassIndexMeasurement.h │ ├── caps_bodyWeightMeasurement.c │ ├── caps_bodyWeightMeasurement.h │ ├── caps_button.c │ ├── caps_button.h │ ├── caps_carbonDioxideHealthConcern.c │ ├── caps_carbonDioxideHealthConcern.h │ ├── caps_carbonDioxideMeasurement.c │ ├── caps_carbonDioxideMeasurement.h │ ├── caps_carbonMonoxideDetector.c │ ├── caps_carbonMonoxideDetector.h │ ├── caps_carbonMonoxideMeasurement.c │ ├── caps_carbonMonoxideMeasurement.h │ ├── caps_colorControl.c │ ├── caps_colorControl.h │ ├── caps_colorTemperature.c │ ├── caps_colorTemperature.h │ ├── caps_contactSensor.c │ ├── caps_contactSensor.h │ ├── caps_dishwasherOperatingState.c │ ├── caps_dishwasherOperatingState.h │ ├── caps_doorControl.c │ ├── caps_doorControl.h │ ├── caps_dryerOperatingState.c │ ├── caps_dryerOperatingState.h │ ├── caps_dustHealthConcern.c │ ├── caps_dustHealthConcern.h │ ├── caps_dustSensor.c │ ├── caps_dustSensor.h │ ├── caps_energyMeter.c │ ├── caps_energyMeter.h │ ├── caps_equivalentCarbonDioxideMeasurement.c │ ├── caps_equivalentCarbonDioxideMeasurement.h │ ├── caps_execute.c │ ├── caps_execute.h │ ├── caps_fanOscillationMode.c │ ├── caps_fanOscillationMode.h │ ├── caps_fanSpeed.c │ ├── caps_fanSpeed.h │ ├── caps_filterStatus.c │ ├── caps_filterStatus.h │ ├── caps_fineDustHealthConcern.c │ ├── caps_fineDustHealthConcern.h │ ├── caps_fineDustSensor.c │ ├── caps_fineDustSensor.h │ ├── caps_firmwareUpdate.c │ ├── caps_firmwareUpdate.h │ ├── caps_formaldehydeMeasurement.c │ ├── caps_formaldehydeMeasurement.h │ ├── caps_garageDoorControl.c │ ├── caps_garageDoorControl.h │ ├── caps_gasMeter.c │ ├── caps_gasMeter.h │ ├── caps_illuminanceMeasurement.c │ ├── caps_illuminanceMeasurement.h │ ├── caps_imageCapture.c │ ├── caps_imageCapture.h │ ├── caps_lock.c │ ├── caps_lock.h │ ├── caps_mediaInputSource.c │ ├── caps_mediaInputSource.h │ ├── caps_mediaPlayback.c │ ├── caps_mediaPlayback.h │ ├── caps_mediaPlaybackRepeat.c │ ├── caps_mediaPlaybackRepeat.h │ ├── caps_mediaPlaybackShuffle.c │ ├── caps_mediaPlaybackShuffle.h │ ├── caps_mode.c │ ├── caps_mode.h │ ├── caps_moldHealthConcern.c │ ├── caps_moldHealthConcern.h │ ├── caps_momentary.c │ ├── caps_momentary.h │ ├── caps_motionSensor.c │ ├── caps_motionSensor.h │ ├── caps_objectDetection.c │ ├── caps_objectDetection.h │ ├── caps_odorSensor.c │ ├── caps_odorSensor.h │ ├── caps_operatingState.c │ ├── caps_operatingState.h │ ├── caps_ovenOperatingState.c │ ├── caps_ovenOperatingState.h │ ├── caps_ovenSetpoint.c │ ├── caps_ovenSetpoint.h │ ├── caps_pHMeasurement.c │ ├── caps_pHMeasurement.h │ ├── caps_panicAlarm.c │ ├── caps_panicAlarm.h │ ├── caps_powerMeter.c │ ├── caps_powerMeter.h │ ├── caps_powerSource.c │ ├── caps_powerSource.h │ ├── caps_presenceSensor.c │ ├── caps_presenceSensor.h │ ├── caps_radonHealthConcern.c │ ├── caps_radonHealthConcern.h │ ├── caps_rapidCooling.c │ ├── caps_rapidCooling.h │ ├── caps_refresh.c │ ├── caps_refresh.h │ ├── caps_relativeHumidityMeasurement.c │ ├── caps_relativeHumidityMeasurement.h │ ├── caps_remoteControlStatus.c │ ├── caps_remoteControlStatus.h │ ├── caps_robotCleanerMovement.c │ ├── caps_robotCleanerMovement.h │ ├── caps_robotCleanerTurboMode.c │ ├── caps_robotCleanerTurboMode.h │ ├── caps_samsungTV.c │ ├── caps_samsungTV.h │ ├── caps_securitySystem.c │ ├── caps_securitySystem.h │ ├── caps_signalStrength.c │ ├── caps_signalStrength.h │ ├── caps_sleepSensor.c │ ├── caps_sleepSensor.h │ ├── caps_smokeDetector.c │ ├── caps_smokeDetector.h │ ├── caps_soundPressureLevel.c │ ├── caps_soundPressureLevel.h │ ├── caps_soundSensor.c │ ├── caps_soundSensor.h │ ├── caps_switch.c │ ├── caps_switch.h │ ├── caps_switchLevel.c │ ├── caps_switchLevel.h │ ├── caps_tamperAlert.c │ ├── caps_tamperAlert.h │ ├── caps_temperatureAlarm.c │ ├── caps_temperatureAlarm.h │ ├── caps_temperatureMeasurement.c │ ├── caps_temperatureMeasurement.h │ ├── caps_thermostatCoolingSetpoint.c │ ├── caps_thermostatCoolingSetpoint.h │ ├── caps_thermostatFanMode.c │ ├── caps_thermostatFanMode.h │ ├── caps_thermostatHeatingSetpoint.c │ ├── caps_thermostatHeatingSetpoint.h │ ├── caps_thermostatMode.c │ ├── caps_thermostatMode.h │ ├── caps_thermostatOperatingState.c │ ├── caps_thermostatOperatingState.h │ ├── caps_thermostatSetpoint.c │ ├── caps_thermostatSetpoint.h │ ├── caps_threeAxis.c │ ├── caps_threeAxis.h │ ├── caps_timedSession.c │ ├── caps_timedSession.h │ ├── caps_tone.c │ ├── caps_tone.h │ ├── caps_tvocHealthConcern.c │ ├── caps_tvocHealthConcern.h │ ├── caps_tvocMeasurement.c │ ├── caps_tvocMeasurement.h │ ├── caps_ultravioletIndex.c │ ├── caps_ultravioletIndex.h │ ├── caps_valve.c │ ├── caps_valve.h │ ├── caps_veryFineDustHealthConcern.c │ ├── caps_veryFineDustHealthConcern.h │ ├── caps_veryFineDustSensor.c │ ├── caps_veryFineDustSensor.h │ ├── caps_voltageMeasurement.c │ ├── caps_voltageMeasurement.h │ ├── caps_waterSensor.c │ ├── caps_waterSensor.h │ ├── caps_windowShade.c │ └── caps_windowShade.h └── esp32 │ ├── light_example │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── debug_sdkconfig │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── caps_activityLightingMode.c │ │ ├── caps_activityLightingMode.h │ │ ├── caps_colorTemperature.c │ │ ├── caps_colorTemperature.h │ │ ├── caps_dustSensor.c │ │ ├── caps_dustSensor.h │ │ ├── caps_switch.c │ │ ├── caps_switch.h │ │ ├── caps_switchLevel.c │ │ ├── caps_switchLevel.h │ │ ├── component.mk │ │ ├── device_control.c │ │ ├── device_control.h │ │ ├── device_info.json │ │ ├── idf_component.yml │ │ ├── iot_cli_cmd.c │ │ ├── iot_cli_cmd.h │ │ ├── iot_uart_cli.c │ │ ├── iot_uart_cli.h │ │ ├── main.c │ │ └── onboarding_config.json │ ├── partitions.2MB.csv │ ├── sdkconfig │ ├── sdkconfig.esp32 │ ├── sdkconfig.esp32c3 │ └── sdkconfig.esp32s3 │ ├── ota_demo │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── debug_sdkconfig │ ├── main │ │ ├── CMakeLists.txt │ │ ├── Kconfig.projbuild │ │ ├── caps_firmwareUpdate.c │ │ ├── caps_firmwareUpdate.h │ │ ├── caps_switch.c │ │ ├── caps_switch.h │ │ ├── caps_switchLevel.c │ │ ├── caps_switchLevel.h │ │ ├── component.mk │ │ ├── device_control.c │ │ ├── device_control.h │ │ ├── device_info.json │ │ ├── idf_component.yml │ │ ├── iot_cli_cmd.c │ │ ├── iot_cli_cmd.h │ │ ├── iot_uart_cli.c │ │ ├── iot_uart_cli.h │ │ ├── main.c │ │ ├── onboarding_config.json │ │ ├── ota_util.c │ │ ├── ota_util.h │ │ ├── public_key.pem │ │ └── root.pem │ ├── partitions.2MB.csv │ ├── sdkconfig │ ├── sdkconfig.esp32 │ ├── sdkconfig.esp32c3 │ └── sdkconfig.esp32s3 │ └── switch_example │ ├── CMakeLists.txt │ ├── Makefile │ ├── README.md │ ├── debug_sdkconfig │ ├── main │ ├── CMakeLists.txt │ ├── Kconfig.projbuild │ ├── caps_switch.c │ ├── caps_switch.h │ ├── component.mk │ ├── device_control.c │ ├── device_control.h │ ├── device_info.json │ ├── idf_component.yml │ ├── iot_cli_cmd.c │ ├── iot_cli_cmd.h │ ├── iot_uart_cli.c │ ├── iot_uart_cli.h │ ├── main.c │ └── onboarding_config.json │ ├── partitions.2MB.csv │ ├── sdkconfig │ ├── sdkconfig.esp32 │ ├── sdkconfig.esp32c3 │ └── sdkconfig.esp32s3 ├── build.py ├── build.sh ├── doc ├── getting_started.md ├── nvs_encryption_esp32.md ├── ota_demo.md └── res │ ├── Light_Example_AMEBA_RTL8195AM.png │ ├── Light_Example_AMEBA_RTL8720C.png │ ├── Light_Example_AMEBA_RTL8721CSM.png │ ├── Light_Example_BL602_DEVKIT.jpg │ ├── Light_Example_ESP32C3_DEVKITC_02.png │ ├── Light_Example_ESP32_DEVKITC.png │ ├── Light_Example_ESP8266_D1_mini.png │ ├── Light_Example_ESP8266_DEVKITC.png │ ├── Light_Example_MXChip_EMW3080.png │ ├── Light_Example_MXChip_EMW3166.png │ ├── Switch_Example_AMEBA_RTL8195AM.png │ ├── Switch_Example_AMEBA_RTL8720CM.png │ ├── Switch_Example_AMEBA_RTL8721CSM.png │ ├── Switch_Example_BL602_DEVKIT.jpg │ ├── Switch_Example_ESP32C3_DEVKITC_02.png │ ├── Switch_Example_ESP32_DEVKITC.png │ ├── Switch_Example_ESP8266_D1_mini.png │ ├── Switch_Example_ESP8266_DEVKITC.png │ ├── Switch_Example_MXChip_EMW3080.png │ ├── Switch_Example_MXChip_EMW3166.png │ ├── add-product-info.gif │ ├── add_device1.png │ ├── add_device2.png │ ├── add_device3.png │ ├── add_health_check_capability.jpg │ ├── add_health_check_capability_switch.jpg │ ├── adding_firmwareUpdate.png │ ├── adding_test_device1.png │ ├── adding_test_device2.png │ ├── create-device-onboarding.gif │ ├── create-device-profile.gif │ ├── create-project.gif │ ├── create_device_onboarding.png │ ├── create_device_profile1.png │ ├── create_device_profile2.png │ ├── create_product_info.png │ ├── create_project1.png │ ├── create_project2.png │ ├── create_project2_lamp.jpg │ ├── demo_ota_network.png │ ├── deploy_to_test.jpg │ ├── deploy_to_test_lamp.jpg │ ├── deploy_to_test_switch.png │ ├── developer_mode.png │ ├── device_control1.png │ ├── device_identity_sn.jpg │ ├── device_identity_sn_lamp.jpg │ ├── direct_connected.jpg │ ├── downloading_onboarding_config_file.jpg │ ├── downloading_onboarding_config_file_lamp.jpg │ ├── downloading_onboarding_config_file_switch.png │ ├── input_public_key.jpg │ ├── ota_diagram.png │ ├── ota_diagram.puml │ ├── ota_flow.png │ ├── ota_information_menu.jpg │ ├── ota_plugins.jpg │ ├── ota_tip_card.jpg │ ├── ota_update_success.jpg │ ├── ota_updating.jpg │ ├── production_ota_network.png │ ├── register-test-device.gif │ ├── sign_in.png │ └── workflow.jpg ├── patches └── bl602 │ └── 0001-add-stdk-compile-modifications-for-bl602.patch ├── setup.py ├── setup.sh └── tools ├── bl602 ├── build_bl602.py ├── build_bl602.sh ├── monitor.py ├── setup_bl602.py └── setup_bl602.sh ├── common ├── check_submodule.py ├── generate_output.py ├── generate_output.sh └── log_decoder.py └── esp32 ├── build_esp32.py ├── build_esp32.sh ├── setup_esp32.py └── setup_esp32.sh /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | ## Marking lists 7 | - [ ] I have read the [Contributing Guidelines](https://github.com/SmartThingsCommunity/st-device-sdk-c/blob/master/CONTRIBUTING.md). 8 | - [ ] I have read the [Samsung Individual CLA](https://github.com/SmartThingsCommunity/st-device-sdk-c/blob/master/doc/SAMSUNGCLA.docx) and agree with it 9 | * We (SmartThings Device SDK team) may ask you to sign it for larger changes. In this case, once we receive it, we'll be able to accept your pull requests according to relevant laws. 10 | 11 | - I submitted this PR against the correct branch: 12 | - [ ] This pull-request is based on the latest [develop](https://github.com/SmartThingsCommunity/st-device-sdk-c-ref/tree/develop) branch. 13 | - [ ] I have ensured local tests pass about my code changes. 14 | 15 | ## License 16 | 17 | Your contribution will be licensed under the [Apache License Ver2.0](https://github.com/SmartThingsCommunity/st-device-sdk-c-ref/blob/master/LICENSE). 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /output/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "iot-core"] 2 | path = iot-core 3 | url = https://github.com/SmartThingsCommunity/st-device-sdk-c.git 4 | [submodule "bsp/esp32"] 5 | path = bsp/esp32 6 | url = https://github.com/espressif/esp-idf.git 7 | [submodule "bsp/bl602"] 8 | path = bsp/bl602 9 | url = https://github.com/bouffalolab/bl_iot_sdk.git 10 | -------------------------------------------------------------------------------- /apps/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | sdkconfig.old 3 | address_info.txt 4 | -------------------------------------------------------------------------------- /apps/bl602/light_example/light_example/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | include $(BL60X_SDK_PATH)/components/network/ble/ble_common.mk 7 | 8 | ifeq ($(CONFIG_ENABLE_PSM_RAM),1) 9 | CPPFLAGS += -DCONF_USER_ENABLE_PSRAM 10 | endif 11 | 12 | ifeq ($(CONFIG_ENABLE_CAMERA),1) 13 | CPPFLAGS += -DCONF_USER_ENABLE_CAMERA 14 | endif 15 | 16 | ifeq ($(CONFIG_ENABLE_BLSYNC),1) 17 | CPPFLAGS += -DCONF_USER_ENABLE_BLSYNC 18 | endif 19 | 20 | ifeq ($(CONFIG_ENABLE_VFS_SPI),1) 21 | CPPFLAGS += -DCONF_USER_ENABLE_VFS_SPI 22 | endif 23 | 24 | ifeq ($(CONFIG_ENABLE_VFS_ROMFS),1) 25 | CPPFLAGS += -DCONF_USER_ENABLE_VFS_ROMFS 26 | endif 27 | 28 | ifeq ($(CONFIG_TD_DIAGNOSIS_STA),1) 29 | CPPFLAGS += -DTD_DIAGNOSIS_STA 30 | endif 31 | 32 | 33 | # define json files list 34 | COMPONENT_EMBED_TXTFILES := onboarding_config.json device_info.json 35 | -------------------------------------------------------------------------------- /apps/bl602/light_example/light_example/caps_activityLightingMode.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_activityLightingMode.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_activityLightingMode_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *lightingMode_value; 31 | 32 | const char *(*get_lightingMode_value)(struct caps_activityLightingMode_data *caps_data); 33 | void (*set_lightingMode_value)(struct caps_activityLightingMode_data *caps_data, const char *value); 34 | int (*attr_lightingMode_str2idx)(const char *value); 35 | void (*attr_lightingMode_send)(struct caps_activityLightingMode_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_activityLightingMode_data *caps_data); 38 | 39 | void (*cmd_setLightingMode_usr_cb)(struct caps_activityLightingMode_data *caps_data); 40 | } caps_activityLightingMode_data_t; 41 | 42 | caps_activityLightingMode_data_t *caps_activityLightingMode_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/bl602/light_example/light_example/caps_colorTemperature.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_colorTemperature.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_colorTemperature_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int colorTemperature_value; 31 | char *colorTemperature_unit; 32 | 33 | int (*get_colorTemperature_value)(struct caps_colorTemperature_data *caps_data); 34 | void (*set_colorTemperature_value)(struct caps_colorTemperature_data *caps_data, int value); 35 | const char *(*get_colorTemperature_unit)(struct caps_colorTemperature_data *caps_data); 36 | void (*set_colorTemperature_unit)(struct caps_colorTemperature_data *caps_data, const char *unit); 37 | void (*attr_colorTemperature_send)(struct caps_colorTemperature_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_colorTemperature_data *caps_data); 40 | 41 | void (*cmd_setColorTemperature_usr_cb)(struct caps_colorTemperature_data *caps_data); 42 | } caps_colorTemperature_data_t; 43 | 44 | caps_colorTemperature_data_t *caps_colorTemperature_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/bl602/light_example/light_example/caps_switch.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switch.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switch_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *switch_value; 31 | 32 | const char *(*get_switch_value)(struct caps_switch_data *caps_data); 33 | void (*set_switch_value)(struct caps_switch_data *caps_data, const char *value); 34 | int (*attr_switch_str2idx)(const char *value); 35 | void (*attr_switch_send)(struct caps_switch_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_switch_data *caps_data); 38 | 39 | void (*cmd_on_usr_cb)(struct caps_switch_data *caps_data); 40 | void (*cmd_off_usr_cb)(struct caps_switch_data *caps_data); 41 | } caps_switch_data_t; 42 | 43 | caps_switch_data_t *caps_switch_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/bl602/light_example/light_example/caps_switchLevel.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switchLevel.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switchLevel_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int level_value; 31 | char *level_unit; 32 | 33 | int (*get_level_value)(struct caps_switchLevel_data *caps_data); 34 | void (*set_level_value)(struct caps_switchLevel_data *caps_data, int value); 35 | const char *(*get_level_unit)(struct caps_switchLevel_data *caps_data); 36 | void (*set_level_unit)(struct caps_switchLevel_data *caps_data, const char *unit); 37 | void (*attr_level_send)(struct caps_switchLevel_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_switchLevel_data *caps_data); 40 | 41 | void (*cmd_setLevel_usr_cb)(struct caps_switchLevel_data *caps_data); 42 | } caps_switchLevel_data_t; 43 | 44 | caps_switchLevel_data_t *caps_switchLevel_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/bl602/light_example/light_example/device_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "deviceInfo": { 3 | "firmwareVersion": "firmwareVersion_here", 4 | "privateKey": "privateKey_here", 5 | "publicKey": "publicKey_here", 6 | "serialNumber": "serialNumber_here" 7 | } 8 | } -------------------------------------------------------------------------------- /apps/bl602/light_example/light_example/onboarding_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "onboardingConfig": { 3 | "deviceOnboardingId": "NAME", 4 | "mnId": "MNID", 5 | "setupId": "999", 6 | "vid": "VID", 7 | "deviceTypeId": "TYPE", 8 | "ownershipValidationTypes": [ 9 | "JUSTWORKS", 10 | "BUTTON", 11 | "PIN", 12 | "QR" 13 | ], 14 | "identityType": "ED25519", 15 | "deviceIntegrationProfileKey": { 16 | "id": "DIP_UUID", 17 | "majorVersion": 0, 18 | "minorVersion": 1 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /apps/bl602/light_example/sdkconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _SDKCONFIG_H_ 2 | #define _SDKCONFIG_H_ 3 | 4 | #define CONFIG_MBEDTLS_XTEA_C 1 5 | #define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 6 | #define CONFIG_MBEDTLS_AES_C 1 7 | #define CONFIG_MBEDTLS_RSA_BITLEN_MIN 2048 8 | #define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 9 | #define CONFIG_MBEDTLS_ECDH_C 1 10 | #define CONFIG_MBEDTLS_PEM_WRITE_C 1 11 | #define CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN 4096 12 | //#define CONFIG_STDK_IOT_CORE_USE_MBEDTLS 1 13 | //#define CONFIG_SSL_USING_MBEDTLS 1 14 | #define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 15 | #define CONFIG_MBEDTLS_ECP_C 1 16 | //#define CONFIG_MBEDTLS_RC4_DISABLED 1 17 | #define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 18 | //#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 19 | //#define CONFIG_MBEDTLS_RSA_BITLEN_2048 1 20 | #define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 21 | #define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 22 | #define CONFIG_MBEDTLS_PEM_PARSE_C 1 23 | #define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 24 | #define CONFIG_MBEDTLS_TLS_ENABLED 1 25 | #define CONFIG_MBEDTLS_TLS_CLIENT 1 26 | #define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 27 | #define CONFIG_MBEDTLS_HAVE_TIME 1 28 | //#define CONFIG_MBEDTLS_TLS_CLIENT_ONLY 1 29 | #define CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN 6144 30 | //#define CONFIG_STDK_MQTT_USE_SSL 31 | //#define CONFIG_STDK_IOT_CORE_EASYSETUP_HTTP_USE_SOCKET_API 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /apps/bl602/switch_example/sdkconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _SDKCONFIG_H_ 2 | #define _SDKCONFIG_H_ 3 | 4 | #define CONFIG_MBEDTLS_XTEA_C 1 5 | #define CONFIG_MBEDTLS_KEY_EXCHANGE_RSA 1 6 | #define CONFIG_MBEDTLS_AES_C 1 7 | #define CONFIG_MBEDTLS_RSA_BITLEN_MIN 2048 8 | #define CONFIG_MBEDTLS_SSL_PROTO_TLS1 1 9 | #define CONFIG_MBEDTLS_ECDH_C 1 10 | #define CONFIG_MBEDTLS_PEM_WRITE_C 1 11 | #define CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN 4096 12 | //#define CONFIG_STDK_IOT_CORE_USE_MBEDTLS 1 13 | //#define CONFIG_SSL_USING_MBEDTLS 1 14 | #define CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED 1 15 | #define CONFIG_MBEDTLS_ECP_C 1 16 | //#define CONFIG_MBEDTLS_RC4_DISABLED 1 17 | #define CONFIG_MBEDTLS_X509_CRL_PARSE_C 1 18 | //#define CONFIG_LIBSODIUM_USE_MBEDTLS_SHA 1 19 | //#define CONFIG_MBEDTLS_RSA_BITLEN_2048 1 20 | #define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 21 | #define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 22 | #define CONFIG_MBEDTLS_PEM_PARSE_C 1 23 | #define CONFIG_MBEDTLS_SSL_PROTO_TLS1_2 1 24 | #define CONFIG_MBEDTLS_TLS_ENABLED 1 25 | #define CONFIG_MBEDTLS_TLS_CLIENT 1 26 | #define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 27 | #define CONFIG_MBEDTLS_HAVE_TIME 1 28 | //#define CONFIG_MBEDTLS_TLS_CLIENT_ONLY 1 29 | #define CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN 6144 30 | //#define CONFIG_STDK_MQTT_USE_SSL 31 | //#define CONFIG_STDK_IOT_CORE_EASYSETUP_HTTP_USE_SOCKET_API 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /apps/bl602/switch_example/switch_example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "main.c" 2 | "device_control.c" 3 | "iot_cli_cmd.c" 4 | "iot_uart_cli.c" 5 | "caps_switch.c" 6 | EMBED_FILES "device_info.json" 7 | "onboarding_config.json" 8 | ) 9 | 10 | set(STDK_IOT_CORE_USE_DEFINED_CONFIG "y") 11 | 12 | add_subdirectory($ENV{STDK_CORE_PATH} iotcore) 13 | target_link_libraries(${COMPONENT_LIB} PUBLIC iotcore) 14 | -------------------------------------------------------------------------------- /apps/bl602/switch_example/switch_example/bouffalo.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | include $(BL60X_SDK_PATH)/components/network/ble/ble_common.mk 7 | 8 | ifeq ($(CONFIG_ENABLE_PSM_RAM),1) 9 | CPPFLAGS += -DCONF_USER_ENABLE_PSRAM 10 | endif 11 | 12 | ifeq ($(CONFIG_ENABLE_CAMERA),1) 13 | CPPFLAGS += -DCONF_USER_ENABLE_CAMERA 14 | endif 15 | 16 | ifeq ($(CONFIG_ENABLE_BLSYNC),1) 17 | CPPFLAGS += -DCONF_USER_ENABLE_BLSYNC 18 | endif 19 | 20 | ifeq ($(CONFIG_ENABLE_VFS_SPI),1) 21 | CPPFLAGS += -DCONF_USER_ENABLE_VFS_SPI 22 | endif 23 | 24 | ifeq ($(CONFIG_ENABLE_VFS_ROMFS),1) 25 | CPPFLAGS += -DCONF_USER_ENABLE_VFS_ROMFS 26 | endif 27 | 28 | ifeq ($(CONFIG_TD_DIAGNOSIS_STA),1) 29 | CPPFLAGS += -DTD_DIAGNOSIS_STA 30 | endif 31 | 32 | 33 | # define json files list 34 | COMPONENT_EMBED_TXTFILES := onboarding_config.json device_info.json 35 | -------------------------------------------------------------------------------- /apps/bl602/switch_example/switch_example/caps_switch.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switch.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switch_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *switch_value; 31 | 32 | const char *(*get_switch_value)(struct caps_switch_data *caps_data); 33 | void (*set_switch_value)(struct caps_switch_data *caps_data, const char *value); 34 | int (*attr_switch_str2idx)(const char *value); 35 | void (*attr_switch_send)(struct caps_switch_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_switch_data *caps_data); 38 | 39 | void (*cmd_on_usr_cb)(struct caps_switch_data *caps_data); 40 | void (*cmd_off_usr_cb)(struct caps_switch_data *caps_data); 41 | } caps_switch_data_t; 42 | 43 | caps_switch_data_t *caps_switch_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/bl602/switch_example/switch_example/device_control.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | 20 | 21 | #define GPIO_INPUT_BUTTON 1 22 | 23 | #define GPIO_OUTPUT_MAINLED 0 24 | 25 | 26 | enum switch_onoff_state { 27 | SWITCH_OFF = 0, 28 | SWITCH_ON = 1, 29 | }; 30 | 31 | enum main_led_gpio_state { 32 | MAINLED_GPIO_ON = 1, 33 | MAINLED_GPIO_OFF = 0, 34 | }; 35 | 36 | enum led_animation_mode_list { 37 | LED_ANIMATION_MODE_IDLE = 0, 38 | LED_ANIMATION_MODE_FAST, 39 | LED_ANIMATION_MODE_SLOW, 40 | }; 41 | 42 | enum button_gpio_state { 43 | BUTTON_GPIO_RELEASED = 1, 44 | BUTTON_GPIO_PRESSED = 0, 45 | }; 46 | 47 | #define BUTTON_DEBOUNCE_TIME_MS 20 48 | #define BUTTON_LONG_THRESHOLD_MS 5000 49 | #define BUTTON_DELAY_MS 300 50 | 51 | enum button_event_type { 52 | BUTTON_LONG_PRESS = 0, 53 | BUTTON_SHORT_PRESS = 1, 54 | }; 55 | 56 | void change_switch_state(int switch_state); 57 | void button_isr_handler(void *arg); 58 | int get_button_event(int* button_event_type, int* button_event_count); 59 | void led_blink(int switch_state, int delay, int count); 60 | void change_led_mode(int noti_led_mode); 61 | void iot_gpio_init(void); 62 | -------------------------------------------------------------------------------- /apps/bl602/switch_example/switch_example/device_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "deviceInfo": { 3 | "firmwareVersion": "firmwareVersion_here", 4 | "privateKey": "privateKey_here", 5 | "publicKey": "publicKey_here", 6 | "serialNumber": "serialNumber_here" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /apps/bl602/switch_example/switch_example/onboarding_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "onboardingConfig": { 3 | "deviceOnboardingId": "NAME", 4 | "mnId": "MNID", 5 | "setupId": "999", 6 | "vid": "VID", 7 | "deviceTypeId": "TYPE", 8 | "ownershipValidationTypes": [ 9 | "JUSTWORKS", 10 | "BUTTON", 11 | "PIN", 12 | "QR" 13 | ], 14 | "identityType": "ED25519", 15 | "deviceIntegrationProfileKey": { 16 | "id": "DIP_UUID", 17 | "majorVersion": 0, 18 | "minorVersion": 1 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /apps/capability_sample/caps_accelerationSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_accelerationSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_accelerationSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *acceleration_value; 31 | 32 | const char *(*get_acceleration_value)(struct caps_accelerationSensor_data *caps_data); 33 | void (*set_acceleration_value)(struct caps_accelerationSensor_data *caps_data, const char *value); 34 | int (*attr_acceleration_str2idx)(const char *value); 35 | void (*attr_acceleration_send)(struct caps_accelerationSensor_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_accelerationSensor_data *caps_data); 38 | } caps_accelerationSensor_data_t; 39 | 40 | caps_accelerationSensor_data_t *caps_accelerationSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_activityLightingMode.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_activityLightingMode.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_activityLightingMode_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *lightingMode_value; 31 | 32 | const char *(*get_lightingMode_value)(struct caps_activityLightingMode_data *caps_data); 33 | void (*set_lightingMode_value)(struct caps_activityLightingMode_data *caps_data, const char *value); 34 | int (*attr_lightingMode_str2idx)(const char *value); 35 | void (*attr_lightingMode_send)(struct caps_activityLightingMode_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_activityLightingMode_data *caps_data); 38 | 39 | void (*cmd_setLightingMode_usr_cb)(struct caps_activityLightingMode_data *caps_data); 40 | } caps_activityLightingMode_data_t; 41 | 42 | caps_activityLightingMode_data_t *caps_activityLightingMode_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_airQualitySensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_airQualitySensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_airQualitySensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int airQuality_value; 31 | char *airQuality_unit; 32 | 33 | int (*get_airQuality_value)(struct caps_airQualitySensor_data *caps_data); 34 | void (*set_airQuality_value)(struct caps_airQualitySensor_data *caps_data, int value); 35 | const char *(*get_airQuality_unit)(struct caps_airQualitySensor_data *caps_data); 36 | void (*set_airQuality_unit)(struct caps_airQualitySensor_data *caps_data, const char *unit); 37 | void (*attr_airQuality_send)(struct caps_airQualitySensor_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_airQualitySensor_data *caps_data); 40 | } caps_airQualitySensor_data_t; 41 | 42 | caps_airQualitySensor_data_t *caps_airQualitySensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_alarm.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_alarm.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_alarm_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *alarm_value; 31 | 32 | const char *(*get_alarm_value)(struct caps_alarm_data *caps_data); 33 | void (*set_alarm_value)(struct caps_alarm_data *caps_data, const char *value); 34 | int (*attr_alarm_str2idx)(const char *value); 35 | void (*attr_alarm_send)(struct caps_alarm_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_alarm_data *caps_data); 38 | 39 | void (*cmd_both_usr_cb)(struct caps_alarm_data *caps_data); 40 | void (*cmd_siren_usr_cb)(struct caps_alarm_data *caps_data); 41 | void (*cmd_off_usr_cb)(struct caps_alarm_data *caps_data); 42 | void (*cmd_strobe_usr_cb)(struct caps_alarm_data *caps_data); 43 | } caps_alarm_data_t; 44 | 45 | caps_alarm_data_t *caps_alarm_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_audioMute.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_audioMute.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_audioMute_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *mute_value; 31 | 32 | const char *(*get_mute_value)(struct caps_audioMute_data *caps_data); 33 | void (*set_mute_value)(struct caps_audioMute_data *caps_data, const char *value); 34 | int (*attr_mute_str2idx)(const char *value); 35 | void (*attr_mute_send)(struct caps_audioMute_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_audioMute_data *caps_data); 38 | 39 | void (*cmd_unmute_usr_cb)(struct caps_audioMute_data *caps_data); 40 | void (*cmd_setMute_usr_cb)(struct caps_audioMute_data *caps_data); 41 | void (*cmd_mute_usr_cb)(struct caps_audioMute_data *caps_data); 42 | } caps_audioMute_data_t; 43 | 44 | caps_audioMute_data_t *caps_audioMute_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_battery.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_battery.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_battery_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int battery_value; 31 | char *battery_unit; 32 | 33 | int (*get_battery_value)(struct caps_battery_data *caps_data); 34 | void (*set_battery_value)(struct caps_battery_data *caps_data, int value); 35 | const char *(*get_battery_unit)(struct caps_battery_data *caps_data); 36 | void (*set_battery_unit)(struct caps_battery_data *caps_data, const char *unit); 37 | void (*attr_battery_send)(struct caps_battery_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_battery_data *caps_data); 40 | } caps_battery_data_t; 41 | 42 | caps_battery_data_t *caps_battery_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_bodyMassIndexMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_bodyMassIndexMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_bodyMassIndexMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double bmiMeasurement_value; 31 | char *bmiMeasurement_unit; 32 | 33 | double (*get_bmiMeasurement_value)(struct caps_bodyMassIndexMeasurement_data *caps_data); 34 | void (*set_bmiMeasurement_value)(struct caps_bodyMassIndexMeasurement_data *caps_data, double value); 35 | const char *(*get_bmiMeasurement_unit)(struct caps_bodyMassIndexMeasurement_data *caps_data); 36 | void (*set_bmiMeasurement_unit)(struct caps_bodyMassIndexMeasurement_data *caps_data, const char *unit); 37 | void (*attr_bmiMeasurement_send)(struct caps_bodyMassIndexMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_bodyMassIndexMeasurement_data *caps_data); 40 | } caps_bodyMassIndexMeasurement_data_t; 41 | 42 | caps_bodyMassIndexMeasurement_data_t *caps_bodyMassIndexMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_bodyWeightMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_bodyWeightMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_bodyWeightMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double bodyWeightMeasurement_value; 31 | char *bodyWeightMeasurement_unit; 32 | 33 | double (*get_bodyWeightMeasurement_value)(struct caps_bodyWeightMeasurement_data *caps_data); 34 | void (*set_bodyWeightMeasurement_value)(struct caps_bodyWeightMeasurement_data *caps_data, double value); 35 | const char *(*get_bodyWeightMeasurement_unit)(struct caps_bodyWeightMeasurement_data *caps_data); 36 | void (*set_bodyWeightMeasurement_unit)(struct caps_bodyWeightMeasurement_data *caps_data, const char *unit); 37 | void (*attr_bodyWeightMeasurement_send)(struct caps_bodyWeightMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_bodyWeightMeasurement_data *caps_data); 40 | } caps_bodyWeightMeasurement_data_t; 41 | 42 | caps_bodyWeightMeasurement_data_t *caps_bodyWeightMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_carbonDioxideHealthConcern.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_carbonDioxideHealthConcern.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_carbonDioxideHealthConcern_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *carbonDioxideHealthConcern_value; 31 | 32 | const char *(*get_carbonDioxideHealthConcern_value)(struct caps_carbonDioxideHealthConcern_data *caps_data); 33 | void (*set_carbonDioxideHealthConcern_value)(struct caps_carbonDioxideHealthConcern_data *caps_data, const char *value); 34 | int (*attr_carbonDioxideHealthConcern_str2idx)(const char *value); 35 | void (*attr_carbonDioxideHealthConcern_send)(struct caps_carbonDioxideHealthConcern_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_carbonDioxideHealthConcern_data *caps_data); 38 | } caps_carbonDioxideHealthConcern_data_t; 39 | 40 | caps_carbonDioxideHealthConcern_data_t *caps_carbonDioxideHealthConcern_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_carbonDioxideMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_carbonDioxideMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_carbonDioxideMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int carbonDioxide_value; 31 | char *carbonDioxide_unit; 32 | 33 | int (*get_carbonDioxide_value)(struct caps_carbonDioxideMeasurement_data *caps_data); 34 | void (*set_carbonDioxide_value)(struct caps_carbonDioxideMeasurement_data *caps_data, int value); 35 | const char *(*get_carbonDioxide_unit)(struct caps_carbonDioxideMeasurement_data *caps_data); 36 | void (*set_carbonDioxide_unit)(struct caps_carbonDioxideMeasurement_data *caps_data, const char *unit); 37 | void (*attr_carbonDioxide_send)(struct caps_carbonDioxideMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_carbonDioxideMeasurement_data *caps_data); 40 | } caps_carbonDioxideMeasurement_data_t; 41 | 42 | caps_carbonDioxideMeasurement_data_t *caps_carbonDioxideMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_carbonMonoxideDetector.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_carbonMonoxideDetector.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_carbonMonoxideDetector_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *carbonMonoxide_value; 31 | 32 | const char *(*get_carbonMonoxide_value)(struct caps_carbonMonoxideDetector_data *caps_data); 33 | void (*set_carbonMonoxide_value)(struct caps_carbonMonoxideDetector_data *caps_data, const char *value); 34 | int (*attr_carbonMonoxide_str2idx)(const char *value); 35 | void (*attr_carbonMonoxide_send)(struct caps_carbonMonoxideDetector_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_carbonMonoxideDetector_data *caps_data); 38 | } caps_carbonMonoxideDetector_data_t; 39 | 40 | caps_carbonMonoxideDetector_data_t *caps_carbonMonoxideDetector_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_colorTemperature.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_colorTemperature.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_colorTemperature_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int colorTemperature_value; 31 | char *colorTemperature_unit; 32 | 33 | int (*get_colorTemperature_value)(struct caps_colorTemperature_data *caps_data); 34 | void (*set_colorTemperature_value)(struct caps_colorTemperature_data *caps_data, int value); 35 | const char *(*get_colorTemperature_unit)(struct caps_colorTemperature_data *caps_data); 36 | void (*set_colorTemperature_unit)(struct caps_colorTemperature_data *caps_data, const char *unit); 37 | void (*attr_colorTemperature_send)(struct caps_colorTemperature_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_colorTemperature_data *caps_data); 40 | 41 | void (*cmd_setColorTemperature_usr_cb)(struct caps_colorTemperature_data *caps_data); 42 | } caps_colorTemperature_data_t; 43 | 44 | caps_colorTemperature_data_t *caps_colorTemperature_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_contactSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_contactSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_contactSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *contact_value; 31 | 32 | const char *(*get_contact_value)(struct caps_contactSensor_data *caps_data); 33 | void (*set_contact_value)(struct caps_contactSensor_data *caps_data, const char *value); 34 | int (*attr_contact_str2idx)(const char *value); 35 | void (*attr_contact_send)(struct caps_contactSensor_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_contactSensor_data *caps_data); 38 | } caps_contactSensor_data_t; 39 | 40 | caps_contactSensor_data_t *caps_contactSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_doorControl.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_doorControl.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_doorControl_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *door_value; 31 | 32 | const char *(*get_door_value)(struct caps_doorControl_data *caps_data); 33 | void (*set_door_value)(struct caps_doorControl_data *caps_data, const char *value); 34 | int (*attr_door_str2idx)(const char *value); 35 | void (*attr_door_send)(struct caps_doorControl_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_doorControl_data *caps_data); 38 | 39 | void (*cmd_close_usr_cb)(struct caps_doorControl_data *caps_data); 40 | void (*cmd_open_usr_cb)(struct caps_doorControl_data *caps_data); 41 | } caps_doorControl_data_t; 42 | 43 | caps_doorControl_data_t *caps_doorControl_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_dustHealthConcern.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_dustHealthConcern.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_dustHealthConcern_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *dustHealthConcern_value; 31 | 32 | const char *(*get_dustHealthConcern_value)(struct caps_dustHealthConcern_data *caps_data); 33 | void (*set_dustHealthConcern_value)(struct caps_dustHealthConcern_data *caps_data, const char *value); 34 | int (*attr_dustHealthConcern_str2idx)(const char *value); 35 | void (*attr_dustHealthConcern_send)(struct caps_dustHealthConcern_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_dustHealthConcern_data *caps_data); 38 | } caps_dustHealthConcern_data_t; 39 | 40 | caps_dustHealthConcern_data_t *caps_dustHealthConcern_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_energyMeter.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2021 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_energyMeter.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_energyMeter_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double energy_value; 31 | char *energy_unit; 32 | 33 | double (*get_energy_value)(struct caps_energyMeter_data *caps_data); 34 | void (*set_energy_value)(struct caps_energyMeter_data *caps_data, double value); 35 | const char *(*get_energy_unit)(struct caps_energyMeter_data *caps_data); 36 | void (*set_energy_unit)(struct caps_energyMeter_data *caps_data, const char *unit); 37 | void (*attr_energy_send)(struct caps_energyMeter_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_energyMeter_data *caps_data); 40 | 41 | void (*cmd_resetEnergyMeter_usr_cb)(struct caps_energyMeter_data *caps_data); 42 | } caps_energyMeter_data_t; 43 | 44 | caps_energyMeter_data_t *caps_energyMeter_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_execute.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_execute.h" 20 | #include "external/JSON.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | typedef struct caps_execute_data { 27 | IOT_CAP_HANDLE* handle; 28 | void *usr_data; 29 | void *cmd_data; 30 | 31 | JSON_H *data_value; 32 | 33 | const JSON_H *(*get_data_value)(struct caps_execute_data *caps_data); 34 | void (*set_data_value)(struct caps_execute_data *caps_data, const JSON_H *value); 35 | void (*attr_data_send)(struct caps_execute_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_execute_data *caps_data); 38 | 39 | void (*cmd_execute_usr_cb)(struct caps_execute_data *caps_data); 40 | } caps_execute_data_t; 41 | 42 | caps_execute_data_t *caps_execute_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_fanSpeed.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_fanSpeed.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_fanSpeed_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int fanSpeed_value; 31 | 32 | int (*get_fanSpeed_value)(struct caps_fanSpeed_data *caps_data); 33 | void (*set_fanSpeed_value)(struct caps_fanSpeed_data *caps_data, int value); 34 | void (*attr_fanSpeed_send)(struct caps_fanSpeed_data *caps_data); 35 | 36 | void (*init_usr_cb)(struct caps_fanSpeed_data *caps_data); 37 | 38 | void (*cmd_setFanSpeed_usr_cb)(struct caps_fanSpeed_data *caps_data); 39 | } caps_fanSpeed_data_t; 40 | 41 | caps_fanSpeed_data_t *caps_fanSpeed_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_filterStatus.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_filterStatus.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_filterStatus_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *filterStatus_value; 31 | 32 | const char *(*get_filterStatus_value)(struct caps_filterStatus_data *caps_data); 33 | void (*set_filterStatus_value)(struct caps_filterStatus_data *caps_data, const char *value); 34 | int (*attr_filterStatus_str2idx)(const char *value); 35 | void (*attr_filterStatus_send)(struct caps_filterStatus_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_filterStatus_data *caps_data); 38 | } caps_filterStatus_data_t; 39 | 40 | caps_filterStatus_data_t *caps_filterStatus_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_fineDustHealthConcern.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_fineDustHealthConcern.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_fineDustHealthConcern_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *fineDustHealthConcern_value; 31 | 32 | const char *(*get_fineDustHealthConcern_value)(struct caps_fineDustHealthConcern_data *caps_data); 33 | void (*set_fineDustHealthConcern_value)(struct caps_fineDustHealthConcern_data *caps_data, const char *value); 34 | int (*attr_fineDustHealthConcern_str2idx)(const char *value); 35 | void (*attr_fineDustHealthConcern_send)(struct caps_fineDustHealthConcern_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_fineDustHealthConcern_data *caps_data); 38 | } caps_fineDustHealthConcern_data_t; 39 | 40 | caps_fineDustHealthConcern_data_t *caps_fineDustHealthConcern_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_fineDustSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_fineDustSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_fineDustSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int fineDustLevel_value; 31 | char *fineDustLevel_unit; 32 | 33 | int (*get_fineDustLevel_value)(struct caps_fineDustSensor_data *caps_data); 34 | void (*set_fineDustLevel_value)(struct caps_fineDustSensor_data *caps_data, int value); 35 | const char *(*get_fineDustLevel_unit)(struct caps_fineDustSensor_data *caps_data); 36 | void (*set_fineDustLevel_unit)(struct caps_fineDustSensor_data *caps_data, const char *unit); 37 | void (*attr_fineDustLevel_send)(struct caps_fineDustSensor_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_fineDustSensor_data *caps_data); 40 | } caps_fineDustSensor_data_t; 41 | 42 | caps_fineDustSensor_data_t *caps_fineDustSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_formaldehydeMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_formaldehydeMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_formaldehydeMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double formaldehydeLevel_value; 31 | char *formaldehydeLevel_unit; 32 | 33 | double (*get_formaldehydeLevel_value)(struct caps_formaldehydeMeasurement_data *caps_data); 34 | void (*set_formaldehydeLevel_value)(struct caps_formaldehydeMeasurement_data *caps_data, double value); 35 | const char *(*get_formaldehydeLevel_unit)(struct caps_formaldehydeMeasurement_data *caps_data); 36 | void (*set_formaldehydeLevel_unit)(struct caps_formaldehydeMeasurement_data *caps_data, const char *unit); 37 | void (*attr_formaldehydeLevel_send)(struct caps_formaldehydeMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_formaldehydeMeasurement_data *caps_data); 40 | } caps_formaldehydeMeasurement_data_t; 41 | 42 | caps_formaldehydeMeasurement_data_t *caps_formaldehydeMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_garageDoorControl.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_garageDoorControl.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_garageDoorControl_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *door_value; 31 | 32 | const char *(*get_door_value)(struct caps_garageDoorControl_data *caps_data); 33 | void (*set_door_value)(struct caps_garageDoorControl_data *caps_data, const char *value); 34 | int (*attr_door_str2idx)(const char *value); 35 | void (*attr_door_send)(struct caps_garageDoorControl_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_garageDoorControl_data *caps_data); 38 | 39 | void (*cmd_close_usr_cb)(struct caps_garageDoorControl_data *caps_data); 40 | void (*cmd_open_usr_cb)(struct caps_garageDoorControl_data *caps_data); 41 | } caps_garageDoorControl_data_t; 42 | 43 | caps_garageDoorControl_data_t *caps_garageDoorControl_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_illuminanceMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_illuminanceMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_illuminanceMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double illuminance_value; 31 | char *illuminance_unit; 32 | 33 | double (*get_illuminance_value)(struct caps_illuminanceMeasurement_data *caps_data); 34 | void (*set_illuminance_value)(struct caps_illuminanceMeasurement_data *caps_data, double value); 35 | const char *(*get_illuminance_unit)(struct caps_illuminanceMeasurement_data *caps_data); 36 | void (*set_illuminance_unit)(struct caps_illuminanceMeasurement_data *caps_data, const char *unit); 37 | void (*attr_illuminance_send)(struct caps_illuminanceMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_illuminanceMeasurement_data *caps_data); 40 | } caps_illuminanceMeasurement_data_t; 41 | 42 | caps_illuminanceMeasurement_data_t *caps_illuminanceMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_lock.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_lock.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_lock_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *lock_value; 31 | 32 | const char *(*get_lock_value)(struct caps_lock_data *caps_data); 33 | void (*set_lock_value)(struct caps_lock_data *caps_data, const char *value); 34 | int (*attr_lock_str2idx)(const char *value); 35 | void (*attr_lock_send)(struct caps_lock_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_lock_data *caps_data); 38 | 39 | void (*cmd_lock_usr_cb)(struct caps_lock_data *caps_data); 40 | void (*cmd_unlock_usr_cb)(struct caps_lock_data *caps_data); 41 | } caps_lock_data_t; 42 | 43 | caps_lock_data_t *caps_lock_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_mediaPlaybackRepeat.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_mediaPlaybackRepeat.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_mediaPlaybackRepeat_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *playbackRepeatMode_value; 31 | 32 | const char *(*get_playbackRepeatMode_value)(struct caps_mediaPlaybackRepeat_data *caps_data); 33 | void (*set_playbackRepeatMode_value)(struct caps_mediaPlaybackRepeat_data *caps_data, const char *value); 34 | int (*attr_playbackRepeatMode_str2idx)(const char *value); 35 | void (*attr_playbackRepeatMode_send)(struct caps_mediaPlaybackRepeat_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_mediaPlaybackRepeat_data *caps_data); 38 | 39 | void (*cmd_setPlaybackRepeatMode_usr_cb)(struct caps_mediaPlaybackRepeat_data *caps_data); 40 | } caps_mediaPlaybackRepeat_data_t; 41 | 42 | caps_mediaPlaybackRepeat_data_t *caps_mediaPlaybackRepeat_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_mediaPlaybackShuffle.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_mediaPlaybackShuffle.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_mediaPlaybackShuffle_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *playbackShuffle_value; 31 | 32 | const char *(*get_playbackShuffle_value)(struct caps_mediaPlaybackShuffle_data *caps_data); 33 | void (*set_playbackShuffle_value)(struct caps_mediaPlaybackShuffle_data *caps_data, const char *value); 34 | int (*attr_playbackShuffle_str2idx)(const char *value); 35 | void (*attr_playbackShuffle_send)(struct caps_mediaPlaybackShuffle_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_mediaPlaybackShuffle_data *caps_data); 38 | 39 | void (*cmd_setPlaybackShuffle_usr_cb)(struct caps_mediaPlaybackShuffle_data *caps_data); 40 | } caps_mediaPlaybackShuffle_data_t; 41 | 42 | caps_mediaPlaybackShuffle_data_t *caps_mediaPlaybackShuffle_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_mode.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2021 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_mode.h" 20 | #include "external/JSON.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | typedef struct caps_mode_data { 27 | IOT_CAP_HANDLE* handle; 28 | void *usr_data; 29 | void *cmd_data; 30 | 31 | char **supportedModes_value; 32 | int supportedModes_arraySize; 33 | char *mode_value; 34 | 35 | const char **(*get_supportedModes_value)(struct caps_mode_data *caps_data); 36 | void (*set_supportedModes_value)(struct caps_mode_data *caps_data, const char **value, int arraySize); 37 | void (*attr_supportedModes_send)(struct caps_mode_data *caps_data); 38 | const char *(*get_mode_value)(struct caps_mode_data *caps_data); 39 | void (*set_mode_value)(struct caps_mode_data *caps_data, const char *value); 40 | void (*attr_mode_send)(struct caps_mode_data *caps_data); 41 | 42 | void (*init_usr_cb)(struct caps_mode_data *caps_data); 43 | 44 | void (*cmd_setMode_usr_cb)(struct caps_mode_data *caps_data); 45 | } caps_mode_data_t; 46 | 47 | caps_mode_data_t *caps_mode_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_moldHealthConcern.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_moldHealthConcern.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_moldHealthConcern_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *moldHealthConcern_value; 31 | 32 | const char *(*get_moldHealthConcern_value)(struct caps_moldHealthConcern_data *caps_data); 33 | void (*set_moldHealthConcern_value)(struct caps_moldHealthConcern_data *caps_data, const char *value); 34 | int (*attr_moldHealthConcern_str2idx)(const char *value); 35 | void (*attr_moldHealthConcern_send)(struct caps_moldHealthConcern_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_moldHealthConcern_data *caps_data); 38 | } caps_moldHealthConcern_data_t; 39 | 40 | caps_moldHealthConcern_data_t *caps_moldHealthConcern_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_momentary.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_momentary.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_momentary_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | 31 | 32 | void (*init_usr_cb)(struct caps_momentary_data *caps_data); 33 | 34 | void (*cmd_push_usr_cb)(struct caps_momentary_data *caps_data); 35 | } caps_momentary_data_t; 36 | 37 | caps_momentary_data_t *caps_momentary_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_motionSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_motionSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_motionSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *motion_value; 31 | 32 | const char *(*get_motion_value)(struct caps_motionSensor_data *caps_data); 33 | void (*set_motion_value)(struct caps_motionSensor_data *caps_data, const char *value); 34 | int (*attr_motion_str2idx)(const char *value); 35 | void (*attr_motion_send)(struct caps_motionSensor_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_motionSensor_data *caps_data); 38 | } caps_motionSensor_data_t; 39 | 40 | caps_motionSensor_data_t *caps_motionSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_odorSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_odorSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_odorSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int odorLevel_value; 31 | 32 | int (*get_odorLevel_value)(struct caps_odorSensor_data *caps_data); 33 | void (*set_odorLevel_value)(struct caps_odorSensor_data *caps_data, int value); 34 | void (*attr_odorLevel_send)(struct caps_odorSensor_data *caps_data); 35 | 36 | void (*init_usr_cb)(struct caps_odorSensor_data *caps_data); 37 | } caps_odorSensor_data_t; 38 | 39 | caps_odorSensor_data_t *caps_odorSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_ovenSetpoint.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_ovenSetpoint.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_ovenSetpoint_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int ovenSetpoint_value; 31 | 32 | int (*get_ovenSetpoint_value)(struct caps_ovenSetpoint_data *caps_data); 33 | void (*set_ovenSetpoint_value)(struct caps_ovenSetpoint_data *caps_data, int value); 34 | void (*attr_ovenSetpoint_send)(struct caps_ovenSetpoint_data *caps_data); 35 | 36 | void (*init_usr_cb)(struct caps_ovenSetpoint_data *caps_data); 37 | 38 | void (*cmd_setOvenSetpoint_usr_cb)(struct caps_ovenSetpoint_data *caps_data); 39 | } caps_ovenSetpoint_data_t; 40 | 41 | caps_ovenSetpoint_data_t *caps_ovenSetpoint_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_pHMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_pHMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_pHMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double pH_value; 31 | char *pH_unit; 32 | 33 | double (*get_pH_value)(struct caps_pHMeasurement_data *caps_data); 34 | void (*set_pH_value)(struct caps_pHMeasurement_data *caps_data, double value); 35 | const char *(*get_pH_unit)(struct caps_pHMeasurement_data *caps_data); 36 | void (*set_pH_unit)(struct caps_pHMeasurement_data *caps_data, const char *unit); 37 | void (*attr_pH_send)(struct caps_pHMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_pHMeasurement_data *caps_data); 40 | } caps_pHMeasurement_data_t; 41 | 42 | caps_pHMeasurement_data_t *caps_pHMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_panicAlarm.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_panicAlarm.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_panicAlarm_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *panicAlarm_value; 31 | 32 | const char *(*get_panicAlarm_value)(struct caps_panicAlarm_data *caps_data); 33 | void (*set_panicAlarm_value)(struct caps_panicAlarm_data *caps_data, const char *value); 34 | int (*attr_panicAlarm_str2idx)(const char *value); 35 | void (*attr_panicAlarm_send)(struct caps_panicAlarm_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_panicAlarm_data *caps_data); 38 | } caps_panicAlarm_data_t; 39 | 40 | caps_panicAlarm_data_t *caps_panicAlarm_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_powerMeter.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_powerMeter.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_powerMeter_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double power_value; 31 | char *power_unit; 32 | 33 | double (*get_power_value)(struct caps_powerMeter_data *caps_data); 34 | void (*set_power_value)(struct caps_powerMeter_data *caps_data, double value); 35 | const char *(*get_power_unit)(struct caps_powerMeter_data *caps_data); 36 | void (*set_power_unit)(struct caps_powerMeter_data *caps_data, const char *unit); 37 | void (*attr_power_send)(struct caps_powerMeter_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_powerMeter_data *caps_data); 40 | } caps_powerMeter_data_t; 41 | 42 | caps_powerMeter_data_t *caps_powerMeter_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_powerSource.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_powerSource.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_powerSource_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *powerSource_value; 31 | 32 | const char *(*get_powerSource_value)(struct caps_powerSource_data *caps_data); 33 | void (*set_powerSource_value)(struct caps_powerSource_data *caps_data, const char *value); 34 | int (*attr_powerSource_str2idx)(const char *value); 35 | void (*attr_powerSource_send)(struct caps_powerSource_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_powerSource_data *caps_data); 38 | } caps_powerSource_data_t; 39 | 40 | caps_powerSource_data_t *caps_powerSource_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_presenceSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_presenceSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_presenceSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *presence_value; 31 | 32 | const char *(*get_presence_value)(struct caps_presenceSensor_data *caps_data); 33 | void (*set_presence_value)(struct caps_presenceSensor_data *caps_data, const char *value); 34 | int (*attr_presence_str2idx)(const char *value); 35 | void (*attr_presence_send)(struct caps_presenceSensor_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_presenceSensor_data *caps_data); 38 | } caps_presenceSensor_data_t; 39 | 40 | caps_presenceSensor_data_t *caps_presenceSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_radonHealthConcern.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_radonHealthConcern.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_radonHealthConcern_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *radonHealthConcern_value; 31 | 32 | const char *(*get_radonHealthConcern_value)(struct caps_radonHealthConcern_data *caps_data); 33 | void (*set_radonHealthConcern_value)(struct caps_radonHealthConcern_data *caps_data, const char *value); 34 | int (*attr_radonHealthConcern_str2idx)(const char *value); 35 | void (*attr_radonHealthConcern_send)(struct caps_radonHealthConcern_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_radonHealthConcern_data *caps_data); 38 | } caps_radonHealthConcern_data_t; 39 | 40 | caps_radonHealthConcern_data_t *caps_radonHealthConcern_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_rapidCooling.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_rapidCooling.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_rapidCooling_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *rapidCooling_value; 31 | 32 | const char *(*get_rapidCooling_value)(struct caps_rapidCooling_data *caps_data); 33 | void (*set_rapidCooling_value)(struct caps_rapidCooling_data *caps_data, const char *value); 34 | int (*attr_rapidCooling_str2idx)(const char *value); 35 | void (*attr_rapidCooling_send)(struct caps_rapidCooling_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_rapidCooling_data *caps_data); 38 | 39 | void (*cmd_setRapidCooling_usr_cb)(struct caps_rapidCooling_data *caps_data); 40 | } caps_rapidCooling_data_t; 41 | 42 | caps_rapidCooling_data_t *caps_rapidCooling_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_refresh.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_refresh.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_refresh_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | 31 | 32 | void (*init_usr_cb)(struct caps_refresh_data *caps_data); 33 | 34 | void (*cmd_refresh_usr_cb)(struct caps_refresh_data *caps_data); 35 | } caps_refresh_data_t; 36 | 37 | caps_refresh_data_t *caps_refresh_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_relativeHumidityMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_relativeHumidityMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_relativeHumidityMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double humidity_value; 31 | char *humidity_unit; 32 | 33 | double (*get_humidity_value)(struct caps_relativeHumidityMeasurement_data *caps_data); 34 | void (*set_humidity_value)(struct caps_relativeHumidityMeasurement_data *caps_data, double value); 35 | const char *(*get_humidity_unit)(struct caps_relativeHumidityMeasurement_data *caps_data); 36 | void (*set_humidity_unit)(struct caps_relativeHumidityMeasurement_data *caps_data, const char *unit); 37 | void (*attr_humidity_send)(struct caps_relativeHumidityMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_relativeHumidityMeasurement_data *caps_data); 40 | } caps_relativeHumidityMeasurement_data_t; 41 | 42 | caps_relativeHumidityMeasurement_data_t *caps_relativeHumidityMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_remoteControlStatus.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_remoteControlStatus.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_remoteControlStatus_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | 29 | char *remoteControlEnabled_value; 30 | const char *(*get_remoteControlEnabled_value)(struct caps_remoteControlStatus_data *caps_data); 31 | void (*set_remoteControlEnabled_value)(struct caps_remoteControlStatus_data *caps_data, const char *value); 32 | int (*attr_remoteControlEnabled_str2idx)(const char *value); 33 | void (*attr_remoteControlEnabled_send)(struct caps_remoteControlStatus_data *caps_data); 34 | 35 | void (*init_usr_cb)(struct caps_remoteControlStatus_data *caps_data); 36 | } caps_remoteControlStatus_data_t; 37 | 38 | caps_remoteControlStatus_data_t *caps_remoteControlStatus_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_robotCleanerMovement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_robotCleanerMovement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_robotCleanerMovement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *robotCleanerMovement_value; 31 | 32 | const char *(*get_robotCleanerMovement_value)(struct caps_robotCleanerMovement_data *caps_data); 33 | void (*set_robotCleanerMovement_value)(struct caps_robotCleanerMovement_data *caps_data, const char *value); 34 | int (*attr_robotCleanerMovement_str2idx)(const char *value); 35 | void (*attr_robotCleanerMovement_send)(struct caps_robotCleanerMovement_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_robotCleanerMovement_data *caps_data); 38 | 39 | void (*cmd_setRobotCleanerMovement_usr_cb)(struct caps_robotCleanerMovement_data *caps_data); 40 | } caps_robotCleanerMovement_data_t; 41 | 42 | caps_robotCleanerMovement_data_t *caps_robotCleanerMovement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_robotCleanerTurboMode.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_robotCleanerTurboMode.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_robotCleanerTurboMode_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *robotCleanerTurboMode_value; 31 | 32 | const char *(*get_robotCleanerTurboMode_value)(struct caps_robotCleanerTurboMode_data *caps_data); 33 | void (*set_robotCleanerTurboMode_value)(struct caps_robotCleanerTurboMode_data *caps_data, const char *value); 34 | int (*attr_robotCleanerTurboMode_str2idx)(const char *value); 35 | void (*attr_robotCleanerTurboMode_send)(struct caps_robotCleanerTurboMode_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_robotCleanerTurboMode_data *caps_data); 38 | 39 | void (*cmd_setRobotCleanerTurboMode_usr_cb)(struct caps_robotCleanerTurboMode_data *caps_data); 40 | } caps_robotCleanerTurboMode_data_t; 41 | 42 | caps_robotCleanerTurboMode_data_t *caps_robotCleanerTurboMode_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_sleepSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_sleepSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_sleepSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *sleeping_value; 31 | 32 | const char *(*get_sleeping_value)(struct caps_sleepSensor_data *caps_data); 33 | void (*set_sleeping_value)(struct caps_sleepSensor_data *caps_data, const char *value); 34 | int (*attr_sleeping_str2idx)(const char *value); 35 | void (*attr_sleeping_send)(struct caps_sleepSensor_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_sleepSensor_data *caps_data); 38 | } caps_sleepSensor_data_t; 39 | 40 | caps_sleepSensor_data_t *caps_sleepSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_smokeDetector.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_smokeDetector.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_smokeDetector_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *smoke_value; 31 | 32 | const char *(*get_smoke_value)(struct caps_smokeDetector_data *caps_data); 33 | void (*set_smoke_value)(struct caps_smokeDetector_data *caps_data, const char *value); 34 | int (*attr_smoke_str2idx)(const char *value); 35 | void (*attr_smoke_send)(struct caps_smokeDetector_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_smokeDetector_data *caps_data); 38 | } caps_smokeDetector_data_t; 39 | 40 | caps_smokeDetector_data_t *caps_smokeDetector_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_soundPressureLevel.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_soundPressureLevel.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_soundPressureLevel_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double soundPressureLevel_value; 31 | char *soundPressureLevel_unit; 32 | 33 | double (*get_soundPressureLevel_value)(struct caps_soundPressureLevel_data *caps_data); 34 | void (*set_soundPressureLevel_value)(struct caps_soundPressureLevel_data *caps_data, double value); 35 | const char *(*get_soundPressureLevel_unit)(struct caps_soundPressureLevel_data *caps_data); 36 | void (*set_soundPressureLevel_unit)(struct caps_soundPressureLevel_data *caps_data, const char *unit); 37 | void (*attr_soundPressureLevel_send)(struct caps_soundPressureLevel_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_soundPressureLevel_data *caps_data); 40 | } caps_soundPressureLevel_data_t; 41 | 42 | caps_soundPressureLevel_data_t *caps_soundPressureLevel_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_soundSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_soundSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_soundSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *sound_value; 31 | 32 | const char *(*get_sound_value)(struct caps_soundSensor_data *caps_data); 33 | void (*set_sound_value)(struct caps_soundSensor_data *caps_data, const char *value); 34 | int (*attr_sound_str2idx)(const char *value); 35 | void (*attr_sound_send)(struct caps_soundSensor_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_soundSensor_data *caps_data); 38 | } caps_soundSensor_data_t; 39 | 40 | caps_soundSensor_data_t *caps_soundSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_switch.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switch.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switch_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *switch_value; 31 | 32 | const char *(*get_switch_value)(struct caps_switch_data *caps_data); 33 | void (*set_switch_value)(struct caps_switch_data *caps_data, const char *value); 34 | int (*attr_switch_str2idx)(const char *value); 35 | void (*attr_switch_send)(struct caps_switch_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_switch_data *caps_data); 38 | 39 | void (*cmd_on_usr_cb)(struct caps_switch_data *caps_data); 40 | void (*cmd_off_usr_cb)(struct caps_switch_data *caps_data); 41 | } caps_switch_data_t; 42 | 43 | caps_switch_data_t *caps_switch_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_switchLevel.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switchLevel.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switchLevel_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int level_value; 31 | char *level_unit; 32 | 33 | int (*get_level_value)(struct caps_switchLevel_data *caps_data); 34 | void (*set_level_value)(struct caps_switchLevel_data *caps_data, int value); 35 | const char *(*get_level_unit)(struct caps_switchLevel_data *caps_data); 36 | void (*set_level_unit)(struct caps_switchLevel_data *caps_data, const char *unit); 37 | void (*attr_level_send)(struct caps_switchLevel_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_switchLevel_data *caps_data); 40 | 41 | void (*cmd_setLevel_usr_cb)(struct caps_switchLevel_data *caps_data); 42 | } caps_switchLevel_data_t; 43 | 44 | caps_switchLevel_data_t *caps_switchLevel_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_tamperAlert.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_tamperAlert.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_tamperAlert_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *tamper_value; 31 | 32 | const char *(*get_tamper_value)(struct caps_tamperAlert_data *caps_data); 33 | void (*set_tamper_value)(struct caps_tamperAlert_data *caps_data, const char *value); 34 | int (*attr_tamper_str2idx)(const char *value); 35 | void (*attr_tamper_send)(struct caps_tamperAlert_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_tamperAlert_data *caps_data); 38 | } caps_tamperAlert_data_t; 39 | 40 | caps_tamperAlert_data_t *caps_tamperAlert_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_temperatureAlarm.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_temperatureAlarm.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_temperatureAlarm_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *temperatureAlarm_value; 31 | 32 | const char *(*get_temperatureAlarm_value)(struct caps_temperatureAlarm_data *caps_data); 33 | void (*set_temperatureAlarm_value)(struct caps_temperatureAlarm_data *caps_data, const char *value); 34 | int (*attr_temperatureAlarm_str2idx)(const char *value); 35 | void (*attr_temperatureAlarm_send)(struct caps_temperatureAlarm_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_temperatureAlarm_data *caps_data); 38 | } caps_temperatureAlarm_data_t; 39 | 40 | caps_temperatureAlarm_data_t *caps_temperatureAlarm_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_temperatureMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_temperatureMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_temperatureMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double temperature_value; 31 | char *temperature_unit; 32 | 33 | double (*get_temperature_value)(struct caps_temperatureMeasurement_data *caps_data); 34 | void (*set_temperature_value)(struct caps_temperatureMeasurement_data *caps_data, double value); 35 | const char *(*get_temperature_unit)(struct caps_temperatureMeasurement_data *caps_data); 36 | void (*set_temperature_unit)(struct caps_temperatureMeasurement_data *caps_data, const char *unit); 37 | void (*attr_temperature_send)(struct caps_temperatureMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_temperatureMeasurement_data *caps_data); 40 | } caps_temperatureMeasurement_data_t; 41 | 42 | caps_temperatureMeasurement_data_t *caps_temperatureMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_thermostatOperatingState.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_thermostatOperatingState.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_thermostatOperatingState_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *thermostatOperatingState_value; 31 | 32 | const char *(*get_thermostatOperatingState_value)(struct caps_thermostatOperatingState_data *caps_data); 33 | void (*set_thermostatOperatingState_value)(struct caps_thermostatOperatingState_data *caps_data, const char *value); 34 | int (*attr_thermostatOperatingState_str2idx)(const char *value); 35 | void (*attr_thermostatOperatingState_send)(struct caps_thermostatOperatingState_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_thermostatOperatingState_data *caps_data); 38 | } caps_thermostatOperatingState_data_t; 39 | 40 | caps_thermostatOperatingState_data_t *caps_thermostatOperatingState_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_thermostatSetpoint.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_thermostatSetpoint.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_thermostatSetpoint_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double thermostatSetpoint_value; 31 | char *thermostatSetpoint_unit; 32 | 33 | double (*get_thermostatSetpoint_value)(struct caps_thermostatSetpoint_data *caps_data); 34 | void (*set_thermostatSetpoint_value)(struct caps_thermostatSetpoint_data *caps_data, double value); 35 | const char *(*get_thermostatSetpoint_unit)(struct caps_thermostatSetpoint_data *caps_data); 36 | void (*set_thermostatSetpoint_unit)(struct caps_thermostatSetpoint_data *caps_data, const char *unit); 37 | void (*attr_thermostatSetpoint_send)(struct caps_thermostatSetpoint_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_thermostatSetpoint_data *caps_data); 40 | } caps_thermostatSetpoint_data_t; 41 | 42 | caps_thermostatSetpoint_data_t *caps_thermostatSetpoint_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_threeAxis.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_threeAxis.h" 20 | #include "external/JSON.h" 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | typedef struct caps_threeAxis_data { 27 | IOT_CAP_HANDLE* handle; 28 | void *usr_data; 29 | void *cmd_data; 30 | 31 | JSON_H *threeAxis_value; 32 | 33 | const JSON_H *(*get_threeAxis_value)(struct caps_threeAxis_data *caps_data); 34 | void (*set_threeAxis_value)(struct caps_threeAxis_data *caps_data, int x, int y, int z); 35 | void (*attr_threeAxis_send)(struct caps_threeAxis_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_threeAxis_data *caps_data); 38 | } caps_threeAxis_data_t; 39 | 40 | caps_threeAxis_data_t *caps_threeAxis_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_tone.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_tone.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_tone_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | 31 | 32 | void (*init_usr_cb)(struct caps_tone_data *caps_data); 33 | 34 | void (*cmd_beep_usr_cb)(struct caps_tone_data *caps_data); 35 | } caps_tone_data_t; 36 | 37 | caps_tone_data_t *caps_tone_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_tvocHealthConcern.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_tvocHealthConcern.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_tvocHealthConcern_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *tvocHealthConcern_value; 31 | 32 | const char *(*get_tvocHealthConcern_value)(struct caps_tvocHealthConcern_data *caps_data); 33 | void (*set_tvocHealthConcern_value)(struct caps_tvocHealthConcern_data *caps_data, const char *value); 34 | int (*attr_tvocHealthConcern_str2idx)(const char *value); 35 | void (*attr_tvocHealthConcern_send)(struct caps_tvocHealthConcern_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_tvocHealthConcern_data *caps_data); 38 | } caps_tvocHealthConcern_data_t; 39 | 40 | caps_tvocHealthConcern_data_t* caps_tvocHealthConcern_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_tvocMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_tvocMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_tvocMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double tvocLevel_value; 31 | char *tvocLevel_unit; 32 | 33 | double (*get_tvocLevel_value)(struct caps_tvocMeasurement_data *caps_data); 34 | void (*set_tvocLevel_value)(struct caps_tvocMeasurement_data *caps_data, double value); 35 | const char *(*get_tvocLevel_unit)(struct caps_tvocMeasurement_data *caps_data); 36 | void (*set_tvocLevel_unit)(struct caps_tvocMeasurement_data *caps_data, const char *unit); 37 | void (*attr_tvocLevel_send)(struct caps_tvocMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_tvocMeasurement_data *caps_data); 40 | } caps_tvocMeasurement_data_t; 41 | 42 | caps_tvocMeasurement_data_t *caps_tvocMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_ultravioletIndex.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_ultravioletIndex.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_ultravioletIndex_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double ultravioletIndex_value; 31 | 32 | double (*get_ultravioletIndex_value)(struct caps_ultravioletIndex_data *caps_data); 33 | void (*set_ultravioletIndex_value)(struct caps_ultravioletIndex_data *caps_data, double value); 34 | void (*attr_ultravioletIndex_send)(struct caps_ultravioletIndex_data *caps_data); 35 | 36 | void (*init_usr_cb)(struct caps_ultravioletIndex_data *caps_data); 37 | } caps_ultravioletIndex_data_t; 38 | 39 | caps_ultravioletIndex_data_t *caps_ultravioletIndex_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_valve.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_valve.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_valve_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *valve_value; 31 | 32 | const char *(*get_valve_value)(struct caps_valve_data *caps_data); 33 | void (*set_valve_value)(struct caps_valve_data *caps_data, const char *value); 34 | int (*attr_valve_str2idx)(const char *value); 35 | void (*attr_valve_send)(struct caps_valve_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_valve_data *caps_data); 38 | 39 | void (*cmd_close_usr_cb)(struct caps_valve_data *caps_data); 40 | void (*cmd_open_usr_cb)(struct caps_valve_data *caps_data); 41 | } caps_valve_data_t; 42 | 43 | caps_valve_data_t *caps_valve_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_veryFineDustHealthConcern.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2022 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_veryFineDustHealthConcern.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_veryFineDustHealthConcern_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *veryFineDustHealthConcern_value; 31 | 32 | const char *(*get_veryFineDustHealthConcern_value)(struct caps_veryFineDustHealthConcern_data *caps_data); 33 | void (*set_veryFineDustHealthConcern_value)(struct caps_veryFineDustHealthConcern_data *caps_data, const char *value); 34 | int (*attr_veryFineDustHealthConcern_str2idx)(const char *value); 35 | void (*attr_veryFineDustHealthConcern_send)(struct caps_veryFineDustHealthConcern_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_veryFineDustHealthConcern_data *caps_data); 38 | } caps_veryFineDustHealthConcern_data_t; 39 | 40 | caps_veryFineDustHealthConcern_data_t *caps_veryFineDustHealthConcern_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_veryFineDustSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_veryFineDustSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_veryFineDustSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int veryFineDustLevel_value; 31 | char *veryFineDustLevel_unit; 32 | 33 | int (*get_veryFineDustLevel_value)(struct caps_veryFineDustSensor_data *caps_data); 34 | void (*set_veryFineDustLevel_value)(struct caps_veryFineDustSensor_data *caps_data, int value); 35 | const char *(*get_veryFineDustLevel_unit)(struct caps_veryFineDustSensor_data *caps_data); 36 | void (*set_veryFineDustLevel_unit)(struct caps_veryFineDustSensor_data *caps_data, const char *unit); 37 | void (*attr_veryFineDustLevel_send)(struct caps_veryFineDustSensor_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_veryFineDustSensor_data *caps_data); 40 | } caps_veryFineDustSensor_data_t; 41 | 42 | caps_veryFineDustSensor_data_t *caps_veryFineDustSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_voltageMeasurement.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_voltageMeasurement.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_voltageMeasurement_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | double voltage_value; 31 | char *voltage_unit; 32 | 33 | double (*get_voltage_value)(struct caps_voltageMeasurement_data *caps_data); 34 | void (*set_voltage_value)(struct caps_voltageMeasurement_data *caps_data, double value); 35 | const char *(*get_voltage_unit)(struct caps_voltageMeasurement_data *caps_data); 36 | void (*set_voltage_unit)(struct caps_voltageMeasurement_data *caps_data, const char *unit); 37 | void (*attr_voltage_send)(struct caps_voltageMeasurement_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_voltageMeasurement_data *caps_data); 40 | } caps_voltageMeasurement_data_t; 41 | 42 | caps_voltageMeasurement_data_t *caps_voltageMeasurement_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/capability_sample/caps_waterSensor.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_waterSensor.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_waterSensor_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *water_value; 31 | 32 | const char *(*get_water_value)(struct caps_waterSensor_data *caps_data); 33 | void (*set_water_value)(struct caps_waterSensor_data *caps_data, const char *value); 34 | int (*attr_water_str2idx)(const char *value); 35 | void (*attr_water_send)(struct caps_waterSensor_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_waterSensor_data *caps_data); 38 | } caps_waterSensor_data_t; 39 | 40 | caps_waterSensor_data_t *caps_waterSensor_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /apps/esp32/light_example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | 7 | project(light_example) 8 | 9 | -------------------------------------------------------------------------------- /apps/esp32/light_example/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := light_example 7 | 8 | EXTRA_COMPONENT_DIRS := ${IDF_PATH}/../../iot-core 9 | 10 | include $(IDF_PATH)/make/project.mk 11 | 12 | -------------------------------------------------------------------------------- /apps/esp32/light_example/debug_sdkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Log output 3 | # 4 | CONFIG_LOG_DEFAULT_LEVEL_NONE= 5 | CONFIG_LOG_DEFAULT_LEVEL_ERROR= 6 | CONFIG_LOG_DEFAULT_LEVEL_WARN= 7 | CONFIG_LOG_DEFAULT_LEVEL_INFO=y 8 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG= 9 | CONFIG_LOG_DEFAULT_LEVEL_VERBOSE= 10 | CONFIG_LOG_DEFAULT_LEVEL=3 11 | CONFIG_LOG_COLORS=y 12 | CONFIG_LOG_SET_LEVEL= 13 | 14 | CONFIG_STDK_DEBUG_MEMORY_CHECK=y 15 | 16 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_ERROR=y 17 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_WARN=y 18 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_INFO=y 19 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_DEBUG= 20 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "main.c" 2 | "device_control.c" 3 | "iot_cli_cmd.c" 4 | "iot_uart_cli.c" 5 | "caps_activityLightingMode.c" 6 | "caps_colorTemperature.c" 7 | "caps_dustSensor.c" 8 | "caps_switch.c" 9 | "caps_switchLevel.c" 10 | EMBED_FILES "device_info.json" 11 | "onboarding_config.json" 12 | ) 13 | 14 | set(STDK_IOT_CORE_USE_DEFINED_CONFIG "y") 15 | 16 | add_subdirectory($ENV{STDK_CORE_PATH} iotcore) 17 | target_link_libraries(${COMPONENT_LIB} PUBLIC iotcore) 18 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/caps_activityLightingMode.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_activityLightingMode.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_activityLightingMode_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *lightingMode_value; 31 | 32 | const char *(*get_lightingMode_value)(struct caps_activityLightingMode_data *caps_data); 33 | void (*set_lightingMode_value)(struct caps_activityLightingMode_data *caps_data, const char *value); 34 | int (*attr_lightingMode_str2idx)(const char *value); 35 | void (*attr_lightingMode_send)(struct caps_activityLightingMode_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_activityLightingMode_data *caps_data); 38 | 39 | void (*cmd_setLightingMode_usr_cb)(struct caps_activityLightingMode_data *caps_data); 40 | } caps_activityLightingMode_data_t; 41 | 42 | caps_activityLightingMode_data_t *caps_activityLightingMode_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/caps_colorTemperature.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_colorTemperature.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_colorTemperature_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int colorTemperature_value; 31 | char *colorTemperature_unit; 32 | 33 | int (*get_colorTemperature_value)(struct caps_colorTemperature_data *caps_data); 34 | void (*set_colorTemperature_value)(struct caps_colorTemperature_data *caps_data, int value); 35 | const char *(*get_colorTemperature_unit)(struct caps_colorTemperature_data *caps_data); 36 | void (*set_colorTemperature_unit)(struct caps_colorTemperature_data *caps_data, const char *unit); 37 | void (*attr_colorTemperature_send)(struct caps_colorTemperature_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_colorTemperature_data *caps_data); 40 | 41 | void (*cmd_setColorTemperature_usr_cb)(struct caps_colorTemperature_data *caps_data); 42 | } caps_colorTemperature_data_t; 43 | 44 | caps_colorTemperature_data_t *caps_colorTemperature_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/caps_switch.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switch.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switch_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *switch_value; 31 | 32 | const char *(*get_switch_value)(struct caps_switch_data *caps_data); 33 | void (*set_switch_value)(struct caps_switch_data *caps_data, const char *value); 34 | int (*attr_switch_str2idx)(const char *value); 35 | void (*attr_switch_send)(struct caps_switch_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_switch_data *caps_data); 38 | 39 | void (*cmd_on_usr_cb)(struct caps_switch_data *caps_data); 40 | void (*cmd_off_usr_cb)(struct caps_switch_data *caps_data); 41 | } caps_switch_data_t; 42 | 43 | caps_switch_data_t *caps_switch_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/caps_switchLevel.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switchLevel.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switchLevel_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int level_value; 31 | char *level_unit; 32 | 33 | int (*get_level_value)(struct caps_switchLevel_data *caps_data); 34 | void (*set_level_value)(struct caps_switchLevel_data *caps_data, int value); 35 | const char *(*get_level_unit)(struct caps_switchLevel_data *caps_data); 36 | void (*set_level_unit)(struct caps_switchLevel_data *caps_data, const char *unit); 37 | void (*attr_level_send)(struct caps_switchLevel_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_switchLevel_data *caps_data); 40 | 41 | void (*cmd_setLevel_usr_cb)(struct caps_switchLevel_data *caps_data); 42 | } caps_switchLevel_data_t; 43 | 44 | caps_switchLevel_data_t *caps_switchLevel_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_EMBED_TXTFILES := onboarding_config.json device_info.json -------------------------------------------------------------------------------- /apps/esp32/light_example/main/device_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "deviceInfo": { 3 | "firmwareVersion": "firmwareVersion_here", 4 | "privateKey": "privateKey_here", 5 | "publicKey": "publicKey_here", 6 | "serialNumber": "serialNumber_here" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/idf_component.yml: -------------------------------------------------------------------------------- 1 | ## IDF Component Manager Manifest File 2 | dependencies: 3 | espressif/libsodium: "^1.0.20" 4 | ## Required IDF version 5 | idf: 6 | version: ">=4.1.0" 7 | # # Put list of dependencies here 8 | # # For components maintained by Espressif: 9 | # component: "~1.0.0" 10 | # # For 3rd party components: 11 | # username/component: ">=1.0.0,<2.0.0" 12 | # username2/component2: 13 | # version: "~1.0.0" 14 | # # For transient dependencies `public` flag can be set. 15 | # # `public` flag doesn't have an effect dependencies of the `main` component. 16 | # # All dependencies of `main` are public by default. 17 | # public: true 18 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/iot_cli_cmd.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | void register_iot_cli_cmd(void); 20 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/iot_uart_cli.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #ifndef _IOT_ESP_UART_CLI_H_ 20 | #define _IOT_ESP_UART_CLI_H_ 21 | 22 | #define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0])) 23 | #define CLI_TASK_PRIORITY (5) 24 | #define CLI_TASK_SIZE (8192) 25 | #define MAX_UART_LINE_SIZE (1024) 26 | typedef void (* command_function_t)(char *string); 27 | 28 | typedef struct cli_command { 29 | char *command; 30 | char *help_string; 31 | command_function_t command_fn; 32 | } cli_cmd_t; 33 | 34 | typedef struct cli_command_list { 35 | cli_cmd_t* cmd; 36 | struct cli_command_list* next; 37 | } cli_cmd_list_t; 38 | 39 | void uart_cli_main(); 40 | void cli_register_command(cli_cmd_t* cmd); 41 | 42 | #endif /* _IOT_ESP_UART_CLI_H_ */ 43 | -------------------------------------------------------------------------------- /apps/esp32/light_example/main/onboarding_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "onboardingConfig": { 3 | "deviceOnboardingId": "NAME", 4 | "mnId": "MNID", 5 | "setupId": "999", 6 | "vid": "VID", 7 | "deviceTypeId": "TYPE", 8 | "ownershipValidationTypes": [ 9 | "JUSTWORKS", 10 | "BUTTON", 11 | "PIN", 12 | "QR" 13 | ], 14 | "identityType": "ED25519", 15 | "deviceIntegrationProfileKey": { 16 | "id": "DIP_UUID", 17 | "majorVersion": 0, 18 | "minorVersion": 1 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /apps/esp32/light_example/partitions.2MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | stnv, data, nvs, , 0x4000, 3 | nvs, data, nvs, , 0x4000, 4 | otadata, data, ota, , 0x2000, 5 | phy_init, data, phy, , 0x1000, 6 | nvs_key, data, nvs_keys, , 0x1000, encrypted 7 | ota_0, app, ota_0, , 0x1b0000, 8 | ota_1, app, ota_1, , 0x1b0000, 9 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | 7 | project(ota_demo) 8 | 9 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := ota_demo 7 | 8 | EXTRA_COMPONENT_DIRS := ${IDF_PATH}/../../iot-core 9 | 10 | include $(IDF_PATH)/make/project.mk 11 | 12 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/debug_sdkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Log output 3 | # 4 | CONFIG_LOG_DEFAULT_LEVEL_NONE= 5 | CONFIG_LOG_DEFAULT_LEVEL_ERROR= 6 | CONFIG_LOG_DEFAULT_LEVEL_WARN= 7 | CONFIG_LOG_DEFAULT_LEVEL_INFO=y 8 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG= 9 | CONFIG_LOG_DEFAULT_LEVEL_VERBOSE= 10 | CONFIG_LOG_DEFAULT_LEVEL=3 11 | CONFIG_LOG_COLORS=y 12 | CONFIG_LOG_SET_LEVEL= 13 | 14 | CONFIG_STDK_DEBUG_MEMORY_CHECK=y 15 | 16 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_ERROR=y 17 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_WARN=y 18 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_INFO=y 19 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_DEBUG= 20 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "main.c" 2 | "device_control.c" 3 | "iot_cli_cmd.c" 4 | "iot_uart_cli.c" 5 | "ota_util.c" 6 | "caps_switch.c" 7 | "caps_switchLevel.c" 8 | "caps_firmwareUpdate.c" 9 | INCLUDE_DIRS "$ENV{STDK_CORE_PATH}/src/include/bsp" 10 | "$ENV{STDK_CORE_PATH}/src/include/os" 11 | "$ENV{STDK_CORE_PATH}/src/include/mqtt" 12 | "$ENV{STDK_CORE_PATH}/src/include/external" 13 | "$ENV{STDK_CORE_PATH}/src/port/net/mbedtls" 14 | EMBED_FILES "device_info.json" 15 | "onboarding_config.json" 16 | "public_key.pem" 17 | "root.pem" 18 | ) 19 | 20 | set(STDK_IOT_CORE_USE_DEFINED_CONFIG "y") 21 | 22 | add_subdirectory($ENV{STDK_CORE_PATH} iotcore) 23 | target_link_libraries(${COMPONENT_LIB} PUBLIC iotcore) 24 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/caps_switch.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switch.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switch_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *switch_value; 31 | 32 | const char *(*get_switch_value)(struct caps_switch_data *caps_data); 33 | void (*set_switch_value)(struct caps_switch_data *caps_data, const char *value); 34 | int (*attr_switch_str2idx)(const char *value); 35 | void (*attr_switch_send)(struct caps_switch_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_switch_data *caps_data); 38 | 39 | void (*cmd_on_usr_cb)(struct caps_switch_data *caps_data); 40 | void (*cmd_off_usr_cb)(struct caps_switch_data *caps_data); 41 | } caps_switch_data_t; 42 | 43 | caps_switch_data_t *caps_switch_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/caps_switchLevel.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switchLevel.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switchLevel_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | int level_value; 31 | char *level_unit; 32 | 33 | int (*get_level_value)(struct caps_switchLevel_data *caps_data); 34 | void (*set_level_value)(struct caps_switchLevel_data *caps_data, int value); 35 | const char *(*get_level_unit)(struct caps_switchLevel_data *caps_data); 36 | void (*set_level_unit)(struct caps_switchLevel_data *caps_data, const char *unit); 37 | void (*attr_level_send)(struct caps_switchLevel_data *caps_data); 38 | 39 | void (*init_usr_cb)(struct caps_switchLevel_data *caps_data); 40 | 41 | void (*cmd_setLevel_usr_cb)(struct caps_switchLevel_data *caps_data); 42 | } caps_switchLevel_data_t; 43 | 44 | caps_switchLevel_data_t *caps_switchLevel_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_EMBED_TXTFILES := onboarding_config.json device_info.json root.pem public_key.pem 7 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/device_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "deviceInfo": { 3 | "firmwareVersion": "firmwareVersion_here", 4 | "privateKey": "privateKey_here", 5 | "publicKey": "publicKey_here", 6 | "serialNumber": "serialNumber_here" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/idf_component.yml: -------------------------------------------------------------------------------- 1 | ## IDF Component Manager Manifest File 2 | dependencies: 3 | espressif/libsodium: "^1.0.20" 4 | ## Required IDF version 5 | idf: 6 | version: ">=4.1.0" 7 | # # Put list of dependencies here 8 | # # For components maintained by Espressif: 9 | # component: "~1.0.0" 10 | # # For 3rd party components: 11 | # username/component: ">=1.0.0,<2.0.0" 12 | # username2/component2: 13 | # version: "~1.0.0" 14 | # # For transient dependencies `public` flag can be set. 15 | # # `public` flag doesn't have an effect dependencies of the `main` component. 16 | # # All dependencies of `main` are public by default. 17 | # public: true 18 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/iot_cli_cmd.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | void register_iot_cli_cmd(void); 20 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/iot_uart_cli.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #ifndef _IOT_ESP_UART_CLI_H_ 20 | #define _IOT_ESP_UART_CLI_H_ 21 | 22 | #define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0])) 23 | #define CLI_TASK_PRIORITY (5) 24 | #define CLI_TASK_SIZE (8192) 25 | #define MAX_UART_LINE_SIZE (1024) 26 | typedef void (* command_function_t)(char *string); 27 | 28 | typedef struct cli_command { 29 | char *command; 30 | char *help_string; 31 | command_function_t command_fn; 32 | } cli_cmd_t; 33 | 34 | typedef struct cli_command_list { 35 | cli_cmd_t* cmd; 36 | struct cli_command_list* next; 37 | } cli_cmd_list_t; 38 | 39 | void uart_cli_main(); 40 | void cli_register_command(cli_cmd_t* cmd); 41 | 42 | #endif /* _IOT_ESP_UART_CLI_H_ */ 43 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/onboarding_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "onboardingConfig": { 3 | "deviceOnboardingId": "NAME", 4 | "mnId": "MNID", 5 | "setupId": "999", 6 | "vid": "VID", 7 | "deviceTypeId": "TYPE", 8 | "ownershipValidationTypes": [ 9 | "JUSTWORKS", 10 | "BUTTON", 11 | "PIN", 12 | "QR" 13 | ], 14 | "identityType": "ED25519", 15 | "deviceIntegrationProfileKey": { 16 | "id": "DIP_UUID", 17 | "majorVersion": 0, 18 | "minorVersion": 1 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/ota_util.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright (c) 2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | typedef enum ota_err_type { 20 | OTA_OK = 0, 21 | OTA_FAIL = -1, 22 | OTA_ERR_INVALID_ARG = -2, 23 | OTA_ERR_NO_MEM = -3, 24 | OTA_ERR_INVALID_SIZE = -4 25 | } ota_err_t; 26 | 27 | void ota_nvs_flash_init(); 28 | void ota_check_for_update(void *user_data); 29 | void ota_restart_device(); 30 | ota_err_t ota_update_device(); 31 | int ota_get_polling_period_day(); 32 | ota_err_t ota_api_get_firmware_version_load(unsigned char *device_info, unsigned int device_info_len, char **firmware_version); 33 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/public_key.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | ... 3 | -----END PUBLIC KEY----- 4 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/main/root.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | ... 3 | -----END CERTIFICATE----- 4 | -------------------------------------------------------------------------------- /apps/esp32/ota_demo/partitions.2MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | stnv, data, nvs, , 0x4000, 3 | nvs, data, nvs, , 0x4000, 4 | otadata, data, ota, , 0x2000, 5 | phy_init, data, phy, , 0x1000, 6 | nvs_key, data, nvs_keys, , 0x1000, encrypted 7 | ota_0, app, ota_0, , 0x1d0000, 8 | ota_1, app, ota_1, , 0x1d0000, 9 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | 7 | project(switch_example) 8 | 9 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := switch_example 7 | 8 | EXTRA_COMPONENT_DIRS := ${IDF_PATH}/../../iot-core 9 | 10 | include $(IDF_PATH)/make/project.mk 11 | 12 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/debug_sdkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Log output 3 | # 4 | CONFIG_LOG_DEFAULT_LEVEL_NONE= 5 | CONFIG_LOG_DEFAULT_LEVEL_ERROR= 6 | CONFIG_LOG_DEFAULT_LEVEL_WARN= 7 | CONFIG_LOG_DEFAULT_LEVEL_INFO=y 8 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG= 9 | CONFIG_LOG_DEFAULT_LEVEL_VERBOSE= 10 | CONFIG_LOG_DEFAULT_LEVEL=3 11 | CONFIG_LOG_COLORS=y 12 | CONFIG_LOG_SET_LEVEL= 13 | 14 | CONFIG_STDK_DEBUG_MEMORY_CHECK=y 15 | 16 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_ERROR=y 17 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_WARN=y 18 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_INFO=y 19 | CONFIG_STDK_IOT_CORE_LOG_LEVEL_DEBUG= 20 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS "main.c" 2 | "device_control.c" 3 | "iot_cli_cmd.c" 4 | "iot_uart_cli.c" 5 | "caps_switch.c" 6 | EMBED_FILES "device_info.json" 7 | "onboarding_config.json" 8 | ) 9 | 10 | set(STDK_IOT_CORE_USE_DEFINED_CONFIG "y") 11 | 12 | add_subdirectory($ENV{STDK_CORE_PATH} iotcore) 13 | target_link_libraries(${COMPONENT_LIB} PUBLIC iotcore) 14 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/caps_switch.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019-2020 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #include "caps/iot_caps_helper_switch.h" 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | typedef struct caps_switch_data { 26 | IOT_CAP_HANDLE* handle; 27 | void *usr_data; 28 | void *cmd_data; 29 | 30 | char *switch_value; 31 | 32 | const char *(*get_switch_value)(struct caps_switch_data *caps_data); 33 | void (*set_switch_value)(struct caps_switch_data *caps_data, const char *value); 34 | int (*attr_switch_str2idx)(const char *value); 35 | void (*attr_switch_send)(struct caps_switch_data *caps_data); 36 | 37 | void (*init_usr_cb)(struct caps_switch_data *caps_data); 38 | 39 | void (*cmd_on_usr_cb)(struct caps_switch_data *caps_data); 40 | void (*cmd_off_usr_cb)(struct caps_switch_data *caps_data); 41 | } caps_switch_data_t; 42 | 43 | caps_switch_data_t *caps_switch_initialize(IOT_CTX *ctx, const char *component, void *init_usr_cb, void *usr_data); 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_EMBED_TXTFILES := onboarding_config.json device_info.json -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/device_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "deviceInfo": { 3 | "firmwareVersion": "firmwareVersion_here", 4 | "privateKey": "privateKey_here", 5 | "publicKey": "publicKey_here", 6 | "serialNumber": "serialNumber_here" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/idf_component.yml: -------------------------------------------------------------------------------- 1 | ## IDF Component Manager Manifest File 2 | dependencies: 3 | espressif/libsodium: "^1.0.20" 4 | ## Required IDF version 5 | idf: 6 | version: ">=4.1.0" 7 | # # Put list of dependencies here 8 | # # For components maintained by Espressif: 9 | # component: "~1.0.0" 10 | # # For 3rd party components: 11 | # username/component: ">=1.0.0,<2.0.0" 12 | # username2/component2: 13 | # version: "~1.0.0" 14 | # # For transient dependencies `public` flag can be set. 15 | # # `public` flag doesn't have an effect dependencies of the `main` component. 16 | # # All dependencies of `main` are public by default. 17 | # public: true 18 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/iot_cli_cmd.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | void register_iot_cli_cmd(void); 20 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/iot_uart_cli.h: -------------------------------------------------------------------------------- 1 | /* *************************************************************************** 2 | * 3 | * Copyright 2019 Samsung Electronics All Rights Reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an 13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | * either express or implied. See the License for the specific 15 | * language governing permissions and limitations under the License. 16 | * 17 | ****************************************************************************/ 18 | 19 | #ifndef _IOT_ESP_UART_CLI_H_ 20 | #define _IOT_ESP_UART_CLI_H_ 21 | 22 | #define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0])) 23 | #define CLI_TASK_PRIORITY (5) 24 | #define CLI_TASK_SIZE (8192) 25 | #define MAX_UART_LINE_SIZE (1024) 26 | typedef void (* command_function_t)(char *string); 27 | 28 | typedef struct cli_command { 29 | char *command; 30 | char *help_string; 31 | command_function_t command_fn; 32 | } cli_cmd_t; 33 | 34 | typedef struct cli_command_list { 35 | cli_cmd_t* cmd; 36 | struct cli_command_list* next; 37 | } cli_cmd_list_t; 38 | 39 | void uart_cli_main(); 40 | void cli_register_command(cli_cmd_t* cmd); 41 | 42 | #endif /* _IOT_ESP_UART_CLI_H_ */ 43 | -------------------------------------------------------------------------------- /apps/esp32/switch_example/main/onboarding_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "onboardingConfig": { 3 | "deviceOnboardingId": "NAME", 4 | "mnId": "MNID", 5 | "setupId": "999", 6 | "vid": "VID", 7 | "deviceTypeId": "TYPE", 8 | "ownershipValidationTypes": [ 9 | "JUSTWORKS", 10 | "BUTTON", 11 | "PIN", 12 | "QR" 13 | ], 14 | "identityType": "ED25519", 15 | "deviceIntegrationProfileKey": { 16 | "id": "DIP_UUID", 17 | "majorVersion": 0, 18 | "minorVersion": 1 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /apps/esp32/switch_example/partitions.2MB.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | stnv, data, nvs, , 0x4000, 3 | nvs, data, nvs, , 0x4000, 4 | otadata, data, ota, , 0x2000, 5 | phy_init, data, phy, , 0x1000, 6 | nvs_key, data, nvs_keys, , 0x1000, encrypted 7 | ota_0, app, ota_0, , 0x1b0000, 8 | ota_1, app, ota_1, , 0x1b0000, 9 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | WARN_MSG="WARN : This script will be DEPRECATED. Please use 'build.py'" 4 | 5 | export STDK_CORE_PATH=`readlink -e -n "./iot-core"` 6 | 7 | BSP_NAME=${1} 8 | APP_NAME=${2} 9 | ARGUMENTS=$@ 10 | 11 | if [[ "${1}" == "apps/"*"/"?* ]]; then 12 | BSP_NAME=`echo ${1} | awk -F'/' '{print $2}'` 13 | APP_NAME=`echo ${1} | awk -F'/' '{print $3}'` 14 | shift 1 15 | ARGUMENTS="${BSP_NAME} ${APP_NAME} $@" 16 | fi 17 | 18 | print_usage () { 19 | echo " Usage: ./build.sh BSP_NAME APP_NAME" 20 | echo " or " 21 | echo " ./build.sh apps/BSP_NAME/APP_NAME" 22 | echo "- - - - - - - - - - - - - - - - - - -" 23 | echo " ex) ./build.sh apps/esp8266/switch_example" 24 | echo " ex) ./build.sh apps/esp32/switch_example" 25 | echo " ex) ./build.sh rtl8195 switch_example" 26 | echo " ex) ./build.sh rtl8720c switch_example" 27 | echo " ex) ./build.sh rtl8721c switch_example" 28 | echo " ex) ./build.sh emw3166 switch_example" 29 | echo " ex) ./build.sh emw3080 switch_example" 30 | echo 31 | } 32 | 33 | print_path() { 34 | if [ "${BSP_NAME}" == "" -o ! -d apps/${BSP_NAME} ]; then 35 | echo "Fail to find BSP_NAME (apps/${BSP_NAME}) " 36 | echo "ls apps/" 37 | ls apps/ 38 | elif [ "${APP_NAME}" == "" -o ! -d apps/${BSP_NAME}/${APP_NAME} ]; then 39 | echo "Fail to find APP_NAME (apps/${BSP_NAME}/${APP_NAME})" 40 | echo "ls apps/${BSP_NAME}/" 41 | ls apps/${BSP_NAME} 42 | fi 43 | echo 44 | } 45 | 46 | if [ "${BSP_NAME}" == "" ]; then 47 | print_usage 48 | print_path 49 | echo ${WARN_MSG} 50 | exit 0 51 | fi 52 | 53 | if [ ! -e tools/${BSP_NAME}/build_${BSP_NAME}.sh ]; then 54 | echo "Failed to find tools/${BSP_NAME}/build_${BSP_NAME}.sh" 55 | print_usage 56 | print_path 57 | echo ${WARN_MSG} 58 | exit 1 59 | fi 60 | 61 | tools/${BSP_NAME}/build_${BSP_NAME}.sh ${ARGUMENTS} 62 | if [ "$?" -ne "0" ]; then 63 | print_path 64 | fi 65 | echo ${WARN_MSG} 66 | -------------------------------------------------------------------------------- /doc/res/Light_Example_AMEBA_RTL8195AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_AMEBA_RTL8195AM.png -------------------------------------------------------------------------------- /doc/res/Light_Example_AMEBA_RTL8720C.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_AMEBA_RTL8720C.png -------------------------------------------------------------------------------- /doc/res/Light_Example_AMEBA_RTL8721CSM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_AMEBA_RTL8721CSM.png -------------------------------------------------------------------------------- /doc/res/Light_Example_BL602_DEVKIT.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_BL602_DEVKIT.jpg -------------------------------------------------------------------------------- /doc/res/Light_Example_ESP32C3_DEVKITC_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_ESP32C3_DEVKITC_02.png -------------------------------------------------------------------------------- /doc/res/Light_Example_ESP32_DEVKITC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_ESP32_DEVKITC.png -------------------------------------------------------------------------------- /doc/res/Light_Example_ESP8266_D1_mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_ESP8266_D1_mini.png -------------------------------------------------------------------------------- /doc/res/Light_Example_ESP8266_DEVKITC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_ESP8266_DEVKITC.png -------------------------------------------------------------------------------- /doc/res/Light_Example_MXChip_EMW3080.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_MXChip_EMW3080.png -------------------------------------------------------------------------------- /doc/res/Light_Example_MXChip_EMW3166.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Light_Example_MXChip_EMW3166.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_AMEBA_RTL8195AM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_AMEBA_RTL8195AM.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_AMEBA_RTL8720CM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_AMEBA_RTL8720CM.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_AMEBA_RTL8721CSM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_AMEBA_RTL8721CSM.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_BL602_DEVKIT.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_BL602_DEVKIT.jpg -------------------------------------------------------------------------------- /doc/res/Switch_Example_ESP32C3_DEVKITC_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_ESP32C3_DEVKITC_02.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_ESP32_DEVKITC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_ESP32_DEVKITC.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_ESP8266_D1_mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_ESP8266_D1_mini.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_ESP8266_DEVKITC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_ESP8266_DEVKITC.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_MXChip_EMW3080.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_MXChip_EMW3080.png -------------------------------------------------------------------------------- /doc/res/Switch_Example_MXChip_EMW3166.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/Switch_Example_MXChip_EMW3166.png -------------------------------------------------------------------------------- /doc/res/add-product-info.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/add-product-info.gif -------------------------------------------------------------------------------- /doc/res/add_device1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/add_device1.png -------------------------------------------------------------------------------- /doc/res/add_device2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/add_device2.png -------------------------------------------------------------------------------- /doc/res/add_device3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/add_device3.png -------------------------------------------------------------------------------- /doc/res/add_health_check_capability.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/add_health_check_capability.jpg -------------------------------------------------------------------------------- /doc/res/add_health_check_capability_switch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/add_health_check_capability_switch.jpg -------------------------------------------------------------------------------- /doc/res/adding_firmwareUpdate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/adding_firmwareUpdate.png -------------------------------------------------------------------------------- /doc/res/adding_test_device1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/adding_test_device1.png -------------------------------------------------------------------------------- /doc/res/adding_test_device2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/adding_test_device2.png -------------------------------------------------------------------------------- /doc/res/create-device-onboarding.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create-device-onboarding.gif -------------------------------------------------------------------------------- /doc/res/create-device-profile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create-device-profile.gif -------------------------------------------------------------------------------- /doc/res/create-project.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create-project.gif -------------------------------------------------------------------------------- /doc/res/create_device_onboarding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create_device_onboarding.png -------------------------------------------------------------------------------- /doc/res/create_device_profile1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create_device_profile1.png -------------------------------------------------------------------------------- /doc/res/create_device_profile2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create_device_profile2.png -------------------------------------------------------------------------------- /doc/res/create_product_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create_product_info.png -------------------------------------------------------------------------------- /doc/res/create_project1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create_project1.png -------------------------------------------------------------------------------- /doc/res/create_project2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create_project2.png -------------------------------------------------------------------------------- /doc/res/create_project2_lamp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/create_project2_lamp.jpg -------------------------------------------------------------------------------- /doc/res/demo_ota_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/demo_ota_network.png -------------------------------------------------------------------------------- /doc/res/deploy_to_test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/deploy_to_test.jpg -------------------------------------------------------------------------------- /doc/res/deploy_to_test_lamp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/deploy_to_test_lamp.jpg -------------------------------------------------------------------------------- /doc/res/deploy_to_test_switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/deploy_to_test_switch.png -------------------------------------------------------------------------------- /doc/res/developer_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/developer_mode.png -------------------------------------------------------------------------------- /doc/res/device_control1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/device_control1.png -------------------------------------------------------------------------------- /doc/res/device_identity_sn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/device_identity_sn.jpg -------------------------------------------------------------------------------- /doc/res/device_identity_sn_lamp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/device_identity_sn_lamp.jpg -------------------------------------------------------------------------------- /doc/res/direct_connected.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/direct_connected.jpg -------------------------------------------------------------------------------- /doc/res/downloading_onboarding_config_file.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/downloading_onboarding_config_file.jpg -------------------------------------------------------------------------------- /doc/res/downloading_onboarding_config_file_lamp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/downloading_onboarding_config_file_lamp.jpg -------------------------------------------------------------------------------- /doc/res/downloading_onboarding_config_file_switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/downloading_onboarding_config_file_switch.png -------------------------------------------------------------------------------- /doc/res/input_public_key.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/input_public_key.jpg -------------------------------------------------------------------------------- /doc/res/ota_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/ota_diagram.png -------------------------------------------------------------------------------- /doc/res/ota_diagram.puml: -------------------------------------------------------------------------------- 1 | @startuml 2 | actor "Mobile app" as mobile 3 | database "SmartThings Platform" as cloud 4 | participant "STDK device" as device 5 | database "OTA server" as ota 6 | 7 | device->device: boot 8 | device->cloud: send attributes 9 | note left 10 | currentVersion 11 | end note 12 | ... 13 | device -> ota: request version info 14 | device <-- ota: response version info 15 | device->device: check possible update 16 | device->cloud: send attributes 17 | note left 18 | availableVersion 19 | end note 20 | alt new firmware available 21 | device->cloud: send attributes 22 | note left 23 | updateAvailable: true 24 | end note 25 | end 26 | ... 27 | mobile->mobile: enter device card 28 | alt new firmware available 29 | mobile->mobile: check "New firmware is available." message on device plugin 30 | mobile->mobile: enter Information menu in device plugin 31 | 32 | mobile->mobile: "Update firmware" button is activated. 33 | mobile->mobile: Press "Update firmware" button 34 | mobile->cloud: "updateFirmware" command 35 | cloud->device: "updateFirmware" command 36 | 37 | device->cloud: send attributes 38 | note left 39 | state : updateInProgress 40 | end note 41 | 42 | device->ota: request firmware file 43 | device<--ota: firmware file chunk 44 | device->device: validate and flash firmware 45 | device->device: reboot with new firmware 46 | 47 | device->cloud: send attributes 48 | note left 49 | state : normalOperation 50 | currentVersion 51 | availaableVersion 52 | updateAvailable: false 53 | end note 54 | end 55 | @enduml -------------------------------------------------------------------------------- /doc/res/ota_flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/ota_flow.png -------------------------------------------------------------------------------- /doc/res/ota_information_menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/ota_information_menu.jpg -------------------------------------------------------------------------------- /doc/res/ota_plugins.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/ota_plugins.jpg -------------------------------------------------------------------------------- /doc/res/ota_tip_card.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/ota_tip_card.jpg -------------------------------------------------------------------------------- /doc/res/ota_update_success.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/ota_update_success.jpg -------------------------------------------------------------------------------- /doc/res/ota_updating.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/ota_updating.jpg -------------------------------------------------------------------------------- /doc/res/production_ota_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/production_ota_network.png -------------------------------------------------------------------------------- /doc/res/register-test-device.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/register-test-device.gif -------------------------------------------------------------------------------- /doc/res/sign_in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/sign_in.png -------------------------------------------------------------------------------- /doc/res/workflow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartThingsCommunity/st-device-sdk-c-ref/bdc7e1a38662eddec4d972266a15661cc9a808b2/doc/res/workflow.jpg -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | WARN_MSG="WARN : This script will be DEPRECATED. Please use 'setup.py'" 4 | 5 | export STDK_REF_PATH=$(dirname $(realpath $0)) 6 | export STDK_CORE_PATH="${STDK_REF_PATH}/iot-core" 7 | 8 | CORE_PATH="iot-core" 9 | BSP_NAME=${1} 10 | ARGUMENTS=$@ 11 | 12 | 13 | 14 | print_usage () { 15 | echo " Usage: ./setup.sh BSP_NAME" 16 | echo "- - - - - - - - - - - - - - - - - - -" 17 | echo " ex) ./setup.sh esp8266" 18 | echo " ex) ./setup.sh esp32" 19 | echo " ex) ./setup.sh rtl8195" 20 | echo " ex) ./setup.sh rtl8720c" 21 | echo " ex) ./setup.sh rtl8721c" 22 | echo " ex) ./setup.sh emw3166" 23 | echo " ex) ./setup.sh emw3080" 24 | echo 25 | } 26 | 27 | if [ "${BSP_NAME}" == "" ]; then 28 | print_usage 29 | echo ${WARN_MSG} 30 | exit 0 31 | fi 32 | 33 | if [ ! -e tools/${BSP_NAME}/setup_${BSP_NAME}.sh ]; then 34 | echo "Failed to find tools/${BSP_NAME}/setup_${BSP_NAME}.sh" 35 | print_usage 36 | echo ${WARN_MSG} 37 | exit 1 38 | fi 39 | 40 | git submodule status ${CORE_PATH} &> /dev/null 41 | if [ "$?" == "0" ]; then 42 | git submodule sync ${CORE_PATH} 43 | git submodule init ${CORE_PATH} 44 | git submodule update ${CORE_PATH} 45 | cd ${CORE_PATH} 46 | git reset --hard HEAD 47 | cd .. 48 | fi 49 | 50 | git submodule status bsp/${BSP_NAME} &> /dev/null 51 | if [ "$?" == "0" ]; then 52 | git submodule sync bsp/${BSP_NAME} 53 | git submodule init bsp/${BSP_NAME} 54 | git submodule update bsp/${BSP_NAME} 55 | cd bsp/${BSP_NAME} 56 | git reset --hard HEAD 57 | cd ../.. 58 | fi 59 | 60 | tools/${BSP_NAME}/setup_${BSP_NAME}.sh ${ARGUMENTS} 61 | if [ "$?" == "0" ]; then 62 | echo "" 63 | echo "To use SmartThings Device SDK build script, run following command:" 64 | echo "" 65 | echo " python build.py ${BSP_NAME} [APP_NAME]" 66 | echo "" 67 | fi 68 | echo ${WARN_MSG} 69 | 70 | -------------------------------------------------------------------------------- /tools/bl602/build_bl602.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export CHIP_NAME="BL602" 4 | export BSP_NAME=${1} 5 | export PROJECT_TITLE=${2} 6 | 7 | export STDK_PATH="${PWD}" 8 | export CORE_PATH="${PWD}/iot-core" 9 | 10 | 11 | IOT_APPS_PATH="${PWD}/apps/${BSP_NAME}" 12 | PROJECT_PATH="${IOT_APPS_PATH}/${PROJECT_TITLE}" 13 | BUILD_OUTPUT_PATH="${PROJECT_PATH}/build_out" 14 | BSP_PATH="${STDK_PATH}/bsp/${BSP_NAME}" 15 | BL_FLASH_TOOL="${BSP_PATH}/tools/flash_tool/bflb_iot_tool-ubuntu" 16 | BAUDRATE="2000000" 17 | UART_PORT="/dev/ttyACM0" 18 | PARTITION_TABLE="${BSP_PATH}/tools/flash_tool/chips/bl602/partition/partition_cfg_2M.toml" 19 | APP_FIRMWARE_PATH="${BUILD_OUTPUT_PATH}/${PROJECT_TITLE}.bin" 20 | 21 | 22 | cd ${PROJECT_PATH} 23 | 24 | # build, clean, erase flash, flash, monitor 25 | 26 | if [ "${3}" = "" ]; then 27 | make CONFIG_CHIP_NAME=BL602 CONFIG_LINK_ROM=1 CONFIG_BLE_TP_SERVER=1 CONFIG_BLECONTROLLER_LIB=all -j PTS_GAP_SLAVER_CONFIG_INDICATE_CHARC=1 CONFIG_BT_STACK_PTS=1 28 | elif [ "${3}" = "clean" ]; then 29 | rm -rf ${BUILD_OUTPUT_PATH} 30 | elif [ "${3}" = "erase_flash" ]; then 31 | "${BL_FLASH_TOOL}" --chipname="${CHIP_NAME}" --baudrate="${BAUDRATE}" --port="${4}" --pt="${PARTITION_TABLE}" --dts= --firmware="${APP_FIRMWARE_PATH}" --erase 32 | elif [ "${3}" = "flash" ]; then 33 | if [ ! -d "${BUILD_OUTPUT_PATH}" ]; then 34 | make CONFIG_CHIP_NAME=BL602 CONFIG_LINK_ROM=1 CONFIG_BLE_TP_SERVER=1 CONFIG_BLECONTROLLER_LIB=all -j PTS_GAP_SLAVER_CONFIG_INDICATE_CHARC=1 CONFIG_BT_STACK_PTS=1 35 | fi 36 | "${BL_FLASH_TOOL}" --chipname="${CHIP_NAME}" --baudrate="${BAUDRATE}" --port="${4}" --pt="${PARTITION_TABLE}" --dts= --firmware="${APP_FIRMWARE_PATH}" 37 | elif [ "${3}" = "monitor" ]; then 38 | /usr/bin/python3 "${STDK_PATH}/tools/${BSP_NAME}/monitor.py" "${4}" 39 | fi 40 | 41 | 42 | -------------------------------------------------------------------------------- /tools/bl602/monitor.py: -------------------------------------------------------------------------------- 1 | import serial 2 | import sys 3 | import time 4 | import threading 5 | 6 | def usage(): 7 | print(f"Usage: {sys.argv[0]} ") 8 | print(f"Example: {sys.argv[0]} /dev/ttyACM0 or COM3") 9 | sys.exit(1) 10 | 11 | # get port from input 12 | if len(sys.argv) != 2: 13 | print("len: %d", len(sys.argv)) 14 | usage() 15 | 16 | # configuration 17 | PORT = sys.argv[1] 18 | BAUDRATE = 2000000 19 | SERIAL_BYTESIZE = serial.EIGHTBITS 20 | SERIAL_PARITY = serial.PARITY_NONE 21 | SERIAL_STOPBITS = serial.STOPBITS_ONE 22 | SERIAL_FLOWCONTROL = False 23 | 24 | # init 25 | try: 26 | ser = serial.Serial( 27 | port=PORT, 28 | baudrate=BAUDRATE, 29 | bytesize=SERIAL_BYTESIZE, 30 | parity=SERIAL_PARITY, 31 | stopbits=SERIAL_STOPBITS, 32 | timeout=1, 33 | xonxoff=SERIAL_FLOWCONTROL 34 | ) 35 | print("Serial port opened") 36 | except serial.SerialException as e: 37 | print(f"Can not open serial port: {e}") 38 | exit() 39 | 40 | def read_serial(): 41 | """read data""" 42 | buffer = "" 43 | while True: 44 | if ser.in_waiting > 0: 45 | data = ser.read(ser.in_waiting).decode('utf-8', errors='ignore') 46 | buffer += data 47 | 48 | while '\n' in buffer: 49 | line, buffer = buffer.split('\n', 1) 50 | print(f"{line.strip()}") 51 | 52 | def write_serial(data): 53 | """write data""" 54 | ser.write((data + '\n').encode()) 55 | print(f"{data}") 56 | 57 | if __name__ == "__main__": 58 | # launch read thread 59 | read_thread = threading.Thread(target=read_serial, daemon=True) 60 | read_thread.start() 61 | 62 | try: 63 | while True: 64 | user_input = input() 65 | if user_input.lower() == 'exit': 66 | break 67 | write_serial(user_input) 68 | except KeyboardInterrupt: 69 | print("interrupted") 70 | finally: 71 | ser.close() 72 | print("closed") 73 | -------------------------------------------------------------------------------- /tools/bl602/setup_bl602.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import os 5 | import shutil 6 | 7 | BSP_NAME = sys.argv[1] 8 | CORE_PATH = os.path.join(os.environ["STDK_CORE_PATH"]) 9 | BSP_PATH = os.path.join(os.environ["STDK_REF_PATH"], "bsp", "bl602") 10 | PATCH_PATH = os.path.join(os.environ["STDK_REF_PATH"], "patches", "bl602") 11 | LIBSODIUM_PATH = os.path.join(os.environ["STDK_CORE_PATH"], "src", "deps", "json", "cJSON") 12 | JSON_PATH = os.path.join(os.environ["STDK_CORE_PATH"], "src", "deps", "libsodium", "libsodium") 13 | 14 | os.chdir(LIBSODIUM_PATH) 15 | os.system("git submodule update --init --recursive") 16 | os.system("git submodule foreach --recursive git reset --hard") 17 | 18 | os.chdir(JSON_PATH) 19 | os.system("git submodule update --init --recursive") 20 | os.system("git submodule foreach --recursive git reset --hard") 21 | 22 | os.chdir(BSP_PATH) 23 | os.system("git submodule update --init --recursive") 24 | os.system("git submodule foreach --recursive git reset --hard") 25 | 26 | if os.path.isdir(PATCH_PATH): 27 | os.chdir(BSP_PATH) 28 | for patchfile in sorted(os.listdir(PATCH_PATH)): 29 | if patchfile.endswith(".patch"): 30 | os.system("git apply " + os.path.join(PATCH_PATH, patchfile)) 31 | 32 | 33 | -------------------------------------------------------------------------------- /tools/bl602/setup_bl602.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | install_dependencies() { 4 | echo "Starting to install necessary tools..." 5 | sudo apt-get update 6 | sudo apt-get install -y make gtkterm 7 | if [ $? -ne 0 ]; then 8 | echo "Installation failed. Please ensure there are no errors during the installation process." 9 | exit 1 10 | else 11 | echo "Installation completed." 12 | fi 13 | } 14 | 15 | install_dependencies 16 | 17 | BSP_NAME=${1} 18 | BSP_PATH=${STDK_REF_PATH}/bsp/${BSP_NAME} 19 | PATCH_PATH=${STDK_REF_PATH}/patches/${BSP_NAME} 20 | CORE_PATH=${STDK_REF_PATH}/iot-core 21 | LIBSODIUM_PATH=${CORE_PATH}/src/deps/libsodium/libsodium 22 | JSON_PATH=${CORE_PATH}/src/deps/json/cJSON 23 | 24 | git submodule status bsp/${BSP_NAME} &> /dev/null 25 | if [ "$?" == "0" ]; then 26 | IS_GIT=1 27 | else 28 | IS_GIT=0 29 | fi 30 | 31 | function apply_patch() { 32 | TARGET_DIR=${1} 33 | PATCH_DIR=${2} 34 | 35 | echo "apply-patch : ${TARGET_DIR}" 36 | pushd ${TARGET_DIR} &> /dev/null 37 | for patch in ${PATCH_DIR}/* 38 | do 39 | if [[ "${patch}" == *".patch" ]]; then 40 | if [ "${IS_GIT}" == "1" ]; then 41 | git apply ${patch} 42 | else 43 | patch -f -p1 < ${patch} 44 | fi 45 | fi 46 | done 47 | popd &> /dev/null 48 | } 49 | 50 | pushd {LIBSODIUM_PATH} &> /dev/null 51 | git submodule update --init --recursive 52 | git submodule foreach --recursive git reset --hard 53 | 54 | pushd {LIBSODIUM_PATH} &> /dev/null 55 | git submodule update --init --recursive 56 | git submodule foreach --recursive git reset --hard 57 | 58 | pushd ${BSP_PATH} &> /dev/null 59 | git submodule update --init --recursive 60 | git submodule foreach --recursive git reset --hard 61 | 62 | apply_patch ${BSP_PATH} ${PATCH_PATH} 63 | -------------------------------------------------------------------------------- /tools/common/check_submodule.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import platform 4 | import sys 5 | import os 6 | import subprocess 7 | 8 | def is_valid_submodule(bsp_path, patch_path): 9 | working_dir = os.getcwd() 10 | 11 | os.chdir(patch_path) 12 | number_of_patches = len([file for file in os.listdir(patch_path) if file.endswith("patch")]) 13 | os.chdir(working_dir) 14 | 15 | os.chdir(os.path.dirname(bsp_path)) 16 | bsp_commit_id = subprocess.check_output(['git', 'ls-files', '-s', bsp_path], universal_newlines=True).split(' ')[1][0:7] 17 | os.chdir(working_dir) 18 | 19 | os.chdir(bsp_path) 20 | target_commit_list = subprocess.check_output(['git', 'log', '-n'+str(number_of_patches+1), '--pretty=oneline'], universal_newlines=True).splitlines() 21 | matched_line = [line for line in target_commit_list if line.startswith(bsp_commit_id)] 22 | os.chdir(working_dir) 23 | 24 | if matched_line: 25 | return 1 26 | else: 27 | return 0 28 | 29 | def main(): 30 | try: 31 | BSP_PATH = os.path.abspath(sys.argv[1]) 32 | PATCH_PATH = os.path.abspath(sys.argv[2]) 33 | 34 | if not is_valid_submodule(BSP_PATH, PATCH_PATH): 35 | print("WARN: Unexpected submodule state : ") 36 | print(" (" + BSP_PATH + ")") 37 | print(" If a problem occurs, Please check submodule or use 'setup.py'") 38 | except: 39 | print("WARN: Failed to check submodule state.") 40 | print(" If a problem occurs, Please check submodule or use 'setup.py'") 41 | exit(0) -------------------------------------------------------------------------------- /tools/esp32/setup_esp32.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import os 5 | import shutil 6 | 7 | BSP_NAME = sys.argv[1] 8 | CORE_PATH = os.path.join(os.environ["STDK_CORE_PATH"]) 9 | BSP_PATH = os.path.join(os.environ["STDK_REF_PATH"], "bsp", "esp32") 10 | PATCH_PATH = os.path.join(os.environ["STDK_REF_PATH"], "patches", "esp32") 11 | 12 | CONFIG_PATH = os.path.join(BSP_PATH, "components", "iot-core_config") 13 | 14 | os.chdir(BSP_PATH) 15 | os.system("git submodule update --init --recursive") 16 | os.system("git submodule foreach --recursive git reset --hard") 17 | 18 | os.chdir(BSP_PATH) 19 | if "SHELL" in os.environ: 20 | ret = os.system("./install.sh") 21 | else: 22 | ret = os.system("install.bat") 23 | if not ret: 24 | print("(run in " + BSP_PATH + ",\n Or, use SmartThings Device SDK build script)") 25 | 26 | if os.path.isdir(PATCH_PATH): 27 | os.chdir(BSP_PATH) 28 | for patchfile in sorted(os.listdir(PATCH_PATH)): 29 | if patchfile.endswith(".patch"): 30 | os.system("git am " + os.path.join(PATCH_PATH, patchfile)) 31 | 32 | if not os.path.isdir(CONFIG_PATH): 33 | if os.path.exists(CONFIG_PATH): 34 | os.remove(CONFIG_PATH) 35 | os.makedirs(CONFIG_PATH) 36 | cmake_file = open(os.path.join(CONFIG_PATH, "CMakeLists.txt"), "w") 37 | cmake_file.write("idf_component_register()") 38 | cmake_file.close() 39 | shutil.copy(os.path.join(CORE_PATH, "src", "Kconfig"), os.path.join(BSP_PATH, "components", "iot-core_config", "Kconfig")) 40 | 41 | -------------------------------------------------------------------------------- /tools/esp32/setup_esp32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BSP_NAME=${1} 4 | BSP_PATH=${STDK_REF_PATH}/bsp/${BSP_NAME} 5 | PATCH_PATH=${STDK_REF_PATH}/patches/${BSP_NAME} 6 | 7 | git submodule status bsp/${BSP_NAME} &> /dev/null 8 | if [ "$?" == "0" ]; then 9 | IS_GIT=1 10 | else 11 | IS_GIT=0 12 | fi 13 | 14 | function apply_patch() { 15 | TARGET_DIR=${1} 16 | PATCH_DIR=${2} 17 | 18 | echo "apply-patch : ${TARGET_DIR}" 19 | pushd ${TARGET_DIR} &> /dev/null 20 | for patch in ${PATCH_DIR}/* 21 | do 22 | if [[ "${patch}" == *".patch" ]]; then 23 | if [ "${IS_GIT}" == "1" ]; then 24 | git am ${patch} 25 | else 26 | patch -f -p1 < ${patch} 27 | fi 28 | fi 29 | done 30 | popd &> /dev/null 31 | } 32 | 33 | pushd ${BSP_PATH} &> /dev/null 34 | git submodule update --init --recursive 35 | git submodule foreach --recursive git reset --hard 36 | 37 | ./install.sh 38 | 39 | if [ "$?" == "0" ]; then 40 | echo "(run in ${BSP_PATH}," 41 | echo " OR use SmartThings Device SDK build script)" 42 | fi 43 | 44 | apply_patch ${BSP_PATH} ${PATCH_PATH} 45 | 46 | pushd ${BSP_PATH} &> /dev/null 47 | rm -rf components/iot-core_config 48 | mkdir components/iot-core_config 49 | echo "idf_component_register()" > components/iot-core_config/CMakeLists.txt 50 | cp ${STDK_CORE_PATH}/src/Kconfig ${BSP_PATH}/components/iot-core_config/Kconfig 51 | --------------------------------------------------------------------------------