From: hhk86.heo Date: Tue, 31 Oct 2017 05:41:57 +0000 (+0900) Subject: change appPath, mandatory value X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fdevel%2Fheadless_things_app;p=platform%2Fcore%2Fservice%2Fcloud%2Fua-client.git change appPath, mandatory value Change-Id: I2c5e295f78cfe60d7bd9d67ab27cc04c4e062c32 --- diff --git a/inc/fmwup_headless_thingsapp.h b/inc/fmwup_headless_thingsapp.h index b839880..162965e 100644 --- a/inc/fmwup_headless_thingsapp.h +++ b/inc/fmwup_headless_thingsapp.h @@ -1,12 +1,5 @@ #ifndef __fmwup_headless_thingsapp_H__ #define __fmwup_headless_thingsapp_H__ -#include - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "FMWUP-HEADLESS-THINGSAPP" - #endif /* __fmwup_headless_thingsapp_H__ */ diff --git a/inc/log.h b/inc/log.h index efe181b..505e240 100644 --- a/inc/log.h +++ b/inc/log.h @@ -10,18 +10,28 @@ #include +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "FMWUP-HEADLESS-THINGSAPP" + + //#ifdef LOG_TAG //#undef LOG_TAG //#endif //#define LOG_TAG "ST-THINGS-APP" -#define ERR(fmt, args...) dlog_print(DLOG_ERROR, LOG_TAG, fmt"\n", ##args) -#define WARN(fmt, args...) dlog_print(DLOG_WARN, LOG_TAG, fmt"\n", ##args) -#define INFO(fmt, args...) dlog_print(DLOG_INFO, LOG_TAG, fmt"\n", ##args) -#define DBG(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, fmt"\n", ##args) +#ifndef __MODULE__ +#define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) +#endif + +#define ERR(fmt, args...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s(%d): "fmt"\n", __MODULE__, __func__, __LINE__, ##args) +#define WARN(fmt, args...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s(%d): "fmt"\n", __MODULE__, __func__, __LINE__,##args) +#define INFO(fmt, args...) dlog_print(DLOG_INFO, LOG_TAG, "%s: %s(%d): "fmt"\n", __MODULE__, __func__, __LINE__,##args) +#define DBG(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s(%d): "fmt"\n", __MODULE__, __func__, __LINE__,##args) -#define FN_CALL dlog_print(DLOG_DEBUG, LOG_TAG, ">>>>>>>> called") -#define FN_END dlog_print(DLOG_DEBUG, LOG_TAG, "<<<<<<<< ended") +#define FN_CALL DBG(">>>>>>>> called") +#define FN_END DBG("<<<<<<<< ended") #ifdef __cplusplus } diff --git a/inc/st_things.h b/inc/st_things.h index 83669e3..e041add 100644 --- a/inc/st_things.h +++ b/inc/st_things.h @@ -185,7 +185,7 @@ int st_things_register_pin_handling_cb(st_things_pin_generated_cb generated_ /** * @brief Callback for getting user's input regarding mutual verification. - * @return @c true true in cse of confirmed, otherwise @c false + * @return @c true in case of confirmed, otherwise @c false */ typedef bool (*st_things_user_confirm_cb) (void); @@ -215,7 +215,7 @@ typedef void (*st_things_status_change_cb) (st_things_status_e things_status); * If multiple callbacks are set, the last one is registered only.\n * And the callbacks are called in the internal thread, which is not detached,\n * so application should return it to get the next callbacks. - * @param[in] status_cb Refernce of the callback function to get ST Things status + * @param[in] status_cb Reference of the callback function to get ST Things status * @return @c 0 on success, otherwise a negative error value * @retval #ST_THINGS_ERROR_NONE Successful * @retval #ST_THINGS_ERROR_INVALID_PARAMETER Invalid parameter diff --git a/inc/st_things_types.h b/inc/st_things_types.h index b5f4671..98058ea 100644 --- a/inc/st_things_types.h +++ b/inc/st_things_types.h @@ -54,8 +54,7 @@ typedef enum { /** * @brief Structure for Representation. */ -typedef struct _st_things_representation -{ +typedef struct _st_things_representation { void* payload; /**< Payload of representation */ /** @@ -269,8 +268,7 @@ typedef struct _st_things_representation /** * @brief Structure for representing the Get Request Message. */ -typedef struct _st_things_get_request_message -{ +typedef struct _st_things_get_request_message { char* resource_uri; /**< Resource URI */ char* query; /**< One or more query parameters of the request message. Ex: key1=value1;key2=value2;... */ char* property_key; /**< One or more property key that application needs to set a value for response. Ex: key1;key2;... */ @@ -297,8 +295,7 @@ typedef struct _st_things_get_request_message /** * @brief Structure for representing the Set Request Message. */ -typedef struct _st_things_set_request_message -{ +typedef struct _st_things_set_request_message { char* resource_uri; /**< Resource URI */ char* query; /**< One or more query parameters of the request message. Ex: key1=value1?key2=value2?... */ struct _st_things_representation* rep; /**< Representation of the set request message */ diff --git a/lib/liboicdastack.so b/lib/liboicdastack.so index ca5cd19..3afd8c2 100644 Binary files a/lib/liboicdastack.so and b/lib/liboicdastack.so differ diff --git a/lib/libsdkapi.so b/lib/libsdkapi.so index 436c3e0..14838f1 100644 Binary files a/lib/libsdkapi.so and b/lib/libsdkapi.so differ diff --git a/res/device_def.json b/res/device_def.json index efcb0ef..3469e7f 100644 --- a/res/device_def.json +++ b/res/device_def.json @@ -3,13 +3,13 @@ { "specification": { "device": { - "deviceType": "oic.d.light", - "deviceName": "Samsung Lamp9", + "deviceType": "oic.d.switch", + "deviceName": "hhk Samsung switch9", "specVersion": "core.1.1.0", "dataModelVersion": "res.1.1.0" }, "platform": { - "manufacturerName": "Samsung Electronics", + "manufacturerName": "fAHL", "manufacturerUrl": "http://www.samsung.com/sec/", "manufacturingDate": "2017-08-31", "modelNumber": "NWSP-01", @@ -17,18 +17,17 @@ "osVersion": "1.0", "hardwareVersion": "1.0", "firmwareVersion": "1.0", - "vendorId": "SWC-LIGHT-2017" + "vendorId": "SEC" } }, "resources": { "single": [ { - "uri": "/switch", + "uri": "/capability/switch/0", "types": [ "oic.r.switch.binary" ], "interfaces": [ - "oic.if.a", "oic.if.baseline" ], "policy": 3 @@ -66,21 +65,21 @@ "key": "version", "type": 3, "type_desc": "str (current version)", - "mandatory": true, - "rw": 2 + "mandatory": false, + "rw": 1 }, { "key": "newversion", "type": 3, "type_desc": "str (new version)", - "mandatory": true, + "mandatory": false, "rw": 3 }, { "key": "packageuri", "type": 3, "type_desc": "str (web url)", - "mandatory": true, + "mandatory": false, "rw": 3 }, { @@ -102,13 +101,13 @@ "type": 1, "type_desc": "int (0 : false : nothing do / 1 : true : check new firmware by polling method)", "mandatory": false, - "rw": 2 + "rw": 1 }, { "key": "update", "type": 1, "type_desc": "int (0:init / 1:download Image / 2:update using downloaded image / 3:download and update / 4:scheduled )", - "mandatory": true, + "mandatory": false, "rw": 3 }, { @@ -116,35 +115,35 @@ "type": 3, "type_desc": "str ( Device vendor )", "mandatory": false, - "rw": 2 + "rw": 1 }, { "key": "model", "type": 3, "type_desc": "str ( device model )", "mandatory": false, - "rw": 2 + "rw": 1 }, { "key": "state", "type": 1, "type_desc": "int ( 0 ~ 3 : refer update protocol document )", - "mandatory": true, - "rw": 2 + "mandatory": false, + "rw": 1 }, { "key": "progress", "type": 1, "type_desc": "int ( 0 ~ 100 : progress range )", "mandatory": false, - "rw": 2 + "rw": 1 }, { "key": "result", "type": 1, "type_desc": "int ( 0 ~ 9 : refer update protocol document )", - "mandatory": true, - "rw": 2 + "mandatory": false, + "rw": 1 }, { "key": "updatetime", @@ -169,9 +168,9 @@ "connectivity": { "type": 1, "softAP": { - "manufacturerId": "AAA1", + "manufacturerId": "0AAA", "setupId":"001", - "artik":false + "artik":true } }, "ownershipTransferMethod": 2 @@ -183,8 +182,8 @@ "filePath": { "svrdb": "/opt/usr/home/owner/apps_rw/org.tizen.st-things/data/svr_db_server.dat", "provisioning": "/opt/usr/home/owner/apps_rw/org.tizen.st-things/data/provisioning.json", - "certificate": "/usr/apps/org.tizen.st-things/res/device_test3.cert_chain.pem", - "privateKey": "/usr/apps/org.tizen.st-things/res/device_test3.key.der" + "certificate": "/opt/usr/home/owner/apps_rw/org.tizen.st-things/res/device_test3.cert_chain.pem", + "privateKey": "/opt/usr/home/owner/apps_rw/org.tizen.st-things/res/device_test3.key.der" } } } diff --git a/res/device_test3.cert_chain.pem b/res/device_test3.cert_chain.pem new file mode 100644 index 0000000..307bf1b --- /dev/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GIN CERTIFICATE----- +MIICizCCAi+gAwIBAgIU1oVwZ20jfoUtgdUA3qYh+2boUG4wDAYIKoZIzj0EAwIF +ADBwMS0wKwYDVQQDEyRTYW1zdW5nIEVsZWN0cm9uaWNzIE9DRiBSb290IENBIFRF +U1QxFDASBgNVBAsTC09DRiBSb290IENBMRwwGgYDVQQKExNTYW1zdW5nIEVsZWN0 +cm9uaWNzMQswCQYDVQQGEwJLUjAgFw0xNzA4MTEwODM4MzFaGA8yMDY5MTIzMTE0 +NTk1OVowfTE4MDYGA1UEAxMvU2Ftc3VuZyBFbGVjdHJvbmljcyBPQ0YgRGV2ZWxv +cGVyIFN1YkNBIHYxIFRFU1QxFjAUBgNVBAsTDU9DRiBEZXYgU3ViQ0ExHDAaBgNV +BAoTE1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJBgNVBAYTAktSMFkwEwYHKoZIzj0C +AQYIKoZIzj0DAQcDQgAECATcQdKEge9NTg0V6Q3gQSMVSDK1lEvwDEqDz7q4a/Dz +g5fPktGpAXt2uWzyJ7ivuzdsfFNca4aiwMkBz+oG4KOBlTCBkjAOBgNVHQ8BAf8E +BAMCAQYwLgYDVR0fBCcwJTAjoCGgH4YdaHR0cDovL2NhLnNhbXN1bmdpb3RzLmNv +bS9jcmwwEgYDVR0TAQH/BAgwBgEB/wIBADA8BggrBgEFBQcBAQQwMC4wLAYIKwYB +BQUHMAGGIGh0dHA6Ly9vY3NwLXRlc3Quc2Ftc3VuZ2lvdHMuY29tMAwGCCqGSM49 +BAMCBQADSAAwRQIhAIwbhff04rNXesmvPX6e/18nYZ2AADUsKG3qfHpvTO4oAiAW +WAGKycbIe6CAIe7QSYWFU4tBu81wWcAlF9XJCKDEqQ== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/res/device_test3.key.der b/res/device_test3.key.der new file mode 100644 index 0000000..e25eede Binary files /dev/null and b/res/device_test3.key.der differ diff --git a/src/thing.c b/src/thing.c index 2a0f439..e32473b 100644 --- a/src/thing.c +++ b/src/thing.c @@ -30,16 +30,21 @@ #include "user.h" #include "fmwup_api.h" -#define JSON_PATH "/usr/apps/org.tizen.st-things/res/device_def.json" -static const char *RES_SWITCH = "/switch"; +//#define JSON_PATH "/usr/apps/org.tizen.st-things/res/device_def.json" +#define JSON_PATH "/opt/usr/home/owner/apps_rw/org.tizen.st-things/res/device_def.json" + + +//static const char *RES_SWITCH = "/switch"; +static const char *RES_SWITCH = "/capability/switch/0"; static bool handle_get_request(st_things_get_request_message_s *req_msg, st_things_representation_s *resp_rep) { DBG("resource_uri [%s]", req_msg->resource_uri); - if (0 == strcmp(req_msg->resource_uri, RES_SWITCH)) + if (0 == strcmp(req_msg->resource_uri, RES_SWITCH)) { return handle_get_request_on_switch(req_msg, resp_rep); + } int ret = fmwup_handle_get_request(req_msg, resp_rep); if (ret != 0) { diff --git a/src/user.c b/src/user.c index 79294b6..821ea8f 100644 --- a/src/user.c +++ b/src/user.c @@ -29,7 +29,7 @@ #include "fmwup_api.h" static const char* PROPERTY_VALUE = "value"; -static bool g_switch_value = false; +static bool g_switch_value = true; bool init_user()