#include <unistd.h>
#include <errno.h>
-#if 0
-static void __result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
-{
- LOG_DBG("");
-}
-#endif
void _result(int ret, char* echo, void* data)
{
- LOG_DBG("ret %d", ret);
- LOG_DBG("echo %s", echo);
+ DEBUG_LOG("ret %d", ret);
+ DEBUG_LOG("echo %s", echo);
}
bool service_app_create(void *data)
return;
}
+
+
void service_app_control(app_control_h app_control, void *data)
{
- LOG_DBG("started");
- LOG_DBG("sum %d", test_sum(1,2));
-
+ /* static library function test */
+ DEBUG_LOG("sum %d", test_sum(1,2));
+ /* IPC test using app_control */
hello(_result, NULL);
-#if 0
- app_control_h request;
- app_control_create(&request);
- app_control_set_app_id(request, "org.example.fmw_update_service");
- app_control_set_operation(request, "http://tizen.org/appcontrol/operation/cloud-service/upload");
- int ret = app_control_send_launch_request(request, __result_cb, NULL);
- if (ret != APP_CONTROL_ERROR_NONE) {
- LOG_DBG("app_control_send_launch_request error %d", ret);
- return;
+ /* DB read test with shared data path */
+ char *name;
+ get_name_by_id(1, &name);
+
+ /* rest API test with curl */
+ char *request_uri = "http://iotm-dev-core-external-elb-1621836102.ap-northeast-1.elb.amazonaws.com/api/v1/fota/downloadUrl/?currentVersion=111&token=ZjExNGM1MGUtMWE5YS00NDJiLWE2ZGItNmUzZGM0Y2I4MGE4LnppcA==";
+ char *res_header = NULL;
+ char *res_body = NULL;
+ int ret = http_send_request(FMWUP_HTTP_GET, request_uri, &res_header, &res_body);
+ if( ret != 0) {
+ DEBUG_LOG("http_send_request error %d", ret);
+ }
+ else {
+ DEBUG_LOG("res_body [%s]", res_body);
}
-#endif
-
return;
}
{
int sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
- LOG_DBG("socket error %d", sockfd);
+ DEBUG_LOG("socket error %d", sockfd);
return -1;
}
int len = strlen(serverSA.sun_path) + sizeof(serverSA.sun_family);
int err = connect(sockfd, (struct sockaddr *)&serverSA, len);
if (err < 0 ) {
- LOG_DBG("connect error %d, errno %d", err, errno);
+ DEBUG_LOG("connect error %d, errno %d", err, errno);
/*
if(errno == EACCES)
THROW(MsgException::SECURITY_ERROR, "cannot connect server %s", g_strerror(errno));
}
char buf[20] = "hello";
- LOG_DBG("POST [%s]", buf);
+ DEBUG_LOG("POST [%s]", buf);
err = write(sockfd, (const void*) buf, strlen(buf));
- LOG_DBG("write error %d", err);
+ DEBUG_LOG("write error %d", err);
return 0;
}