change appPath, mandatory value 28/158328/2 devel/headless_things_app
authorhhk86.heo <hhk86.heo@samsung.com>
Tue, 31 Oct 2017 05:41:57 +0000 (14:41 +0900)
committerhhk86.heo <hhk86.heo@samsung.com>
Tue, 31 Oct 2017 06:15:04 +0000 (15:15 +0900)
Change-Id: I2c5e295f78cfe60d7bd9d67ab27cc04c4e062c32

inc/fmwup_headless_thingsapp.h
inc/log.h
inc/st_things.h
inc/st_things_types.h
lib/liboicdastack.so
lib/libsdkapi.so
res/device_def.json
res/device_test3.cert_chain.pem [new file with mode: 0644]
res/device_test3.key.der [new file with mode: 0644]
src/thing.c
src/user.c

index b839880a1f1613ad287155471326ff16628e0c80..162965e1242a1902350f2099df7ee8ada564c7ab 100644 (file)
@@ -1,12 +1,5 @@
 #ifndef __fmwup_headless_thingsapp_H__
 #define __fmwup_headless_thingsapp_H__
 
-#include <dlog.h>
-
-#ifdef  LOG_TAG
-#undef  LOG_TAG
-#endif
-#define LOG_TAG "FMWUP-HEADLESS-THINGSAPP"
-
 
 #endif /* __fmwup_headless_thingsapp_H__ */
index efe181b30f2152863816dab3aef42418a4949432..505e24003aaeee5b353f7d3ddad90a08a4b98b57 100644 (file)
--- a/inc/log.h
+++ b/inc/log.h
 
 #include <dlog.h>
 
+#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
 }
index 83669e374e3f90d9172760b2137851621056c7fc..e041add75fd5795acfaba619a6a3509ce42e6d69 100644 (file)
@@ -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
index b5f46711e98c88dee6923115818bd69a7ac8762d..98058ea90e86ed9a0cfc4dc299c2f7c46bae1320 100644 (file)
@@ -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 */
index ca5cd193c5a1cfac3a6db4bcce1df2d49fcff1ae..3afd8c239992ab1b583ff3c9900c2d9ddeeb733c 100644 (file)
Binary files a/lib/liboicdastack.so and b/lib/liboicdastack.so differ
index 436c3e006d04e6a856e48903c5c36018b4977272..14838f19f68702dab99e0266bdb673162ae4285a 100644 (file)
Binary files a/lib/libsdkapi.so and b/lib/libsdkapi.so differ
index efcb0efe984b0279daaac22f7b26a08552d27178..3469e7f9894b549fe5754896c173eec056ab32ee 100644 (file)
@@ -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",
           "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
           "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
         },
         {
           "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
         },
         {
           "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",
       "connectivity": {
         "type": 1,
         "softAP": {
-          "manufacturerId": "AAA1",
+          "manufacturerId": "0AAA",
           "setupId":"001",
-          "artik":false
+          "artik":true
         }
       },
       "ownershipTransferMethod": 2
     "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 (file)
index 0000000..307bf1b
--- /dev/null
@@ -0,0 +1,33 @@
+-----BEGIN CERTIFICATE-----
+MIICwjCCAmigAwIBAgIaTUNWMVQxNzA5MjAwMTE1MDU4OTcyNzcyNzMwCgYIKoZI
+zj0EAwIwfTE4MDYGA1UEAwwvU2Ftc3VuZyBFbGVjdHJvbmljcyBPQ0YgRGV2ZWxv
+cGVyIFN1YkNBIHYxIFRFU1QxFjAUBgNVBAsMDU9DRiBEZXYgU3ViQ0ExHDAaBgNV
+BAoME1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJBgNVBAYTAktSMB4XDTE3MDkyMDA4
+NDc1N1oXDTE3MTExOTA4NDc1N1owgbIxZjBkBgNVBAMMXURldmVsb3BlciBEZXZp
+Y2UgVEVTVDogQVBJR1dUZXN0ICg5ZDdmYzA4MS0wN2ZhLTQ3MzgtOTVjNy1jY2Zi
+ZTY3OWJjNDQpL2FwaWd3dGVzdEBzYW1zdW5nLmNvbTEdMBsGA1UECwwUT0NGIERl
+diBEZXZpY2UoMDAwMSkxHDAaBgNVBAoME1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJ
+BgNVBAYTAktSMFkwEwYHKoZIzj0CAQYIK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CAQYwLgYDVR0fBCcwJTAjoCGgH4YdaHR0cDovL2NhLnNhbXN1bmdpb3RzLmNv
+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 (file)
index 0000000..e25eede
Binary files /dev/null and b/res/device_test3.key.der differ
index 2a0f43955ddec4be30427baf1fa28e55581e1046..e32473b89d49cd3985bb5e3e76031f963d37008f 100644 (file)
 #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) {
index 79294b6048ee91756be253fa2ee7e60c17f17b23..821ea8fa30d057e253edc69ac663df7a5f78248d 100644 (file)
@@ -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()