#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__ */
#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
}
/**
* @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);
* 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
/**
* @brief Structure for Representation.
*/
-typedef struct _st_things_representation
-{
+typedef struct _st_things_representation {
void* payload; /**< Payload of 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;... */
/**
* @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 */
{
"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"
}
}
}
--- /dev/null
+-----BEGIN CERTIFICATE-----
+MIICwjCCAmigAwIBAgIaTUNWMVQxNzA5MjAwMTE1MDU4OTcyNzcyNzMwCgYIKoZI
+zj0EAwIwfTE4MDYGA1UEAwwvU2Ftc3VuZyBFbGVjdHJvbmljcyBPQ0YgRGV2ZWxv
+cGVyIFN1YkNBIHYxIFRFU1QxFjAUBgNVBAsMDU9DRiBEZXYgU3ViQ0ExHDAaBgNV
+BAoME1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJBgNVBAYTAktSMB4XDTE3MDkyMDA4
+NDc1N1oXDTE3MTExOTA4NDc1N1owgbIxZjBkBgNVBAMMXURldmVsb3BlciBEZXZp
+Y2UgVEVTVDogQVBJR1dUZXN0ICg5ZDdmYzA4MS0wN2ZhLTQ3MzgtOTVjNy1jY2Zi
+ZTY3OWJjNDQpL2FwaWd3dGVzdEBzYW1zdW5nLmNvbTEdMBsGA1UECwwUT0NGIERl
+diBEZXZpY2UoMDAwMSkxHDAaBgNVBAoME1NhbXN1bmcgRWxlY3Ryb25pY3MxCzAJ
+BgNVBAYTAktSMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEAmLuZDUO5A5MqOyf
+KHxs+1IjOqwSDBKJ8t0UgAvSwJSUt2l1IXt/zW7Yh88BfbfdXJBIjZRuHoHbGINe
+wht13qOBiTCBhjALBgNVHQ8EBAMCA8gwPAYIKwYBBQUHAQEEMDAuMCwGCCsGAQUF
+BzABhiBodHRwOi8vb2NzcC10ZXN0LnNhbXN1bmdpb3RzLmNvbTAuBgNVHR8EJzAl
+MCOgIaAfhh1odHRwOi8vY2Euc2Ftc3VuZ2lvdHMuY29tL2NybDAJBgNVHRMEAjAA
+MAoGCCqGSM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ERTIFICATE-----
\ No newline at end of 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) {
#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()