Commit b9b502dd authored by chen.weican's avatar chen.weican

【修改内容】去掉部分warning

parent 3d890a75
...@@ -52,7 +52,11 @@ const char DM_MSG_TO_MIDDWARE[] = "{\"msgtype\":\"%s\",\"productCode\":\"%s\",\" ...@@ -52,7 +52,11 @@ const char DM_MSG_TO_MIDDWARE[] = "{\"msgtype\":\"%s\",\"productCode\":\"%s\",\"
#define KK_POWER_SWITCH_2 "PowerSwitch_2" #define KK_POWER_SWITCH_2 "PowerSwitch_2"
#define KK_POWER_SWITCH_3 "PowerSwitch_3" #define KK_POWER_SWITCH_3 "PowerSwitch_3"
extern char* KK_Make_Topic(cJSON *info);
extern int KK_Subdev_UnSubscribe(cJSON *payload);
extern int KK_Subdev_UnSubscribe_By_DeviceCode(const char *deviceCode,const char *productCode );
extern int KK_Subdev_Subscribe(const cJSON *root);
int KK_Send_CloudState(int state);
static char *s_split_product[] = { static char *s_split_product[] = {
"3002", //星辰系列双路面板 "3002", //星辰系列双路面板
...@@ -145,7 +149,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic) ...@@ -145,7 +149,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic)
cJSON_AddNumberToObject(pParam_new, KK_POWER_SWITCH_1, powerswitch1->valueint); cJSON_AddNumberToObject(pParam_new, KK_POWER_SWITCH_1, powerswitch1->valueint);
cJSON_AddItemToObject(pData,MSG_PARAMS_STR,pParam_new); cJSON_AddItemToObject(pData,MSG_PARAMS_STR,pParam_new);
char* out=cJSON_Print(pData); char* out=cJSON_Print(pData);
KK_MQTT_SendMsg(topic,(const char*)out); KK_MQTT_SendMsg((char*)topic,(const char*)out);
free(out); free(out);
} }
...@@ -157,7 +161,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic) ...@@ -157,7 +161,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic)
cJSON_AddNumberToObject(pParam_new, KK_POWER_SWITCH_2, powerswitch2->valueint); cJSON_AddNumberToObject(pParam_new, KK_POWER_SWITCH_2, powerswitch2->valueint);
cJSON_AddItemToObject(pData,MSG_PARAMS_STR,pParam_new); cJSON_AddItemToObject(pData,MSG_PARAMS_STR,pParam_new);
char* out=cJSON_Print(pData); char* out=cJSON_Print(pData);
KK_MQTT_SendMsg(topic,(const char*)out); KK_MQTT_SendMsg((char*)topic,(const char*)out);
free(out); free(out);
} }
powerswitch3 = cJSON_GetObjectItem(pParam, KK_POWER_SWITCH_3); powerswitch3 = cJSON_GetObjectItem(pParam, KK_POWER_SWITCH_3);
...@@ -167,7 +171,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic) ...@@ -167,7 +171,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic)
cJSON_AddNumberToObject(pParam_new, KK_POWER_SWITCH_3, powerswitch3->valueint); cJSON_AddNumberToObject(pParam_new, KK_POWER_SWITCH_3, powerswitch3->valueint);
cJSON_AddItemToObject(pData,MSG_PARAMS_STR,pParam_new); cJSON_AddItemToObject(pData,MSG_PARAMS_STR,pParam_new);
char* out=cJSON_Print(pData); char* out=cJSON_Print(pData);
KK_MQTT_SendMsg(topic,(const char*)out); KK_MQTT_SendMsg((char*)topic,(const char*)out);
free(out); free(out);
} }
free(param_tmp); free(param_tmp);
...@@ -181,6 +185,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic) ...@@ -181,6 +185,7 @@ static int kk_split_send_data(cJSON *pData,const char* topic)
*返 回 值: 0:成功;其他:失败 *返 回 值: 0:成功;其他:失败
*其他说明: *其他说明:
*************************************************************/ *************************************************************/
int _kk_sendto_cloud(cJSON *root) int _kk_sendto_cloud(cJSON *root)
{ {
cJSON *info,*pData; cJSON *info,*pData;
...@@ -271,18 +276,15 @@ void KK_Data_FromDev(void* str,int len) ...@@ -271,18 +276,15 @@ void KK_Data_FromDev(void* str,int len)
ERROR_PRINT("[%s][%d] root is null \n",__FUNCTION__,__LINE__); ERROR_PRINT("[%s][%d] root is null \n",__FUNCTION__,__LINE__);
return; return;
} }
ERROR_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
cmd = cJSON_GetObjectItem(root, "cmd"); cmd = cJSON_GetObjectItem(root, "cmd");
if(cmd == NULL){ if(cmd == NULL){
_kk_sendto_cloud(root); _kk_sendto_cloud(root);
ERROR_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
} }
else{ else{
KK_Subdev_Subscribe(root); KK_Subdev_Subscribe(root);
} }
ERROR_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
cJSON_Delete(root); cJSON_Delete(root);
ERROR_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
} }
/************************************************************ /************************************************************
*功能描述:无效主题过滤 *功能描述:无效主题过滤
...@@ -339,7 +341,7 @@ static int _check_invalid_topic(const char* topic) ...@@ -339,7 +341,7 @@ static int _check_invalid_topic(const char* topic)
*************************************************************/ *************************************************************/
static int _kk_topic_parse_msgType(_IN_ char *topic, _IN_ int start_deli,_OU_ char **msgTypeStr) static int _kk_topic_parse_msgType(_IN_ char *topic, _IN_ int start_deli,_OU_ char **msgTypeStr)
{ {
int res = 0, start = 0, len = 0, slice = 0; int res = 0, start = 0, len = 0;
char *msgTypeStr_tmp = NULL; char *msgTypeStr_tmp = NULL;
if (topic == NULL) { if (topic == NULL) {
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <pthread.h> #include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "MQTTAsync.h" #include "MQTTAsync.h"
#include "mqtt_api.h" #include "mqtt_api.h"
#include "com_api.h" #include "com_api.h"
......
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
#include "com_api.h" #include "com_api.h"
#include "kk_product.h" #include "kk_product.h"
#include "kk_log.h" #include "kk_log.h"
#include "kk_hal.h"
#include "mqtt_api.h"
static pthread_mutex_t s_data_mutex; static pthread_mutex_t s_data_mutex;
extern int kk_get_gw_status(void);
#define TO_OLED_NANOMSG_SOCKET_ADDR "ipc:///tmp/oled_pair.ipc" #define TO_OLED_NANOMSG_SOCKET_ADDR "ipc:///tmp/oled_pair.ipc"
static int kk_info_nanomsg_init(void) static int kk_info_nanomsg_init(void)
{ {
...@@ -135,7 +138,6 @@ void *kk_info_nanomsg_send(void *data) ...@@ -135,7 +138,6 @@ void *kk_info_nanomsg_send(void *data)
} }
int kk_info_report_start(void) int kk_info_report_start(void)
{ {
void *status;
int rc; int rc;
pthread_t info_report_thread; pthread_t info_report_thread;
pthread_attr_t info_report_attr; pthread_attr_t info_report_attr;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "cJSON.h" #include "cJSON.h"
#include "com_api.h" #include "com_api.h"
#include "kk_hal.h"
#include "kk_product.h" #include "kk_product.h"
#include "kcloud_config.h" #include "kcloud_config.h"
...@@ -196,12 +197,9 @@ int arrayToStr(unsigned char *buf, unsigned int buflen, char *out) ...@@ -196,12 +197,9 @@ int arrayToStr(unsigned char *buf, unsigned int buflen, char *out)
static char * kk_create_register_info() static char * kk_create_register_info()
{ {
cJSON *root; cJSON *root;
char testout[64] = {0};
char outlen = 0;
char *out = NULL; char *out = NULL;
char *productCode = KK_CCU_PRODUCTID; char *productCode = KK_CCU_PRODUCTID;
char *signSource,*base64Out = NULL; char *signSource,*base64Out = NULL;
int len = 0,tleng = 0;
char mac[16] = {0}; char mac[16] = {0};
char ramdonId[16] = {0}; char ramdonId[16] = {0};
unsigned char sign_hex[32] = {0}; unsigned char sign_hex[32] = {0};
...@@ -302,8 +300,6 @@ int kk_start_ccu_register(void) ...@@ -302,8 +300,6 @@ int kk_start_ccu_register(void)
int sockfd, ret, i, h; int sockfd, ret, i, h;
struct sockaddr_in servaddr; struct sockaddr_in servaddr;
char buf[1024] = {0}, buf2[1024] = {0}; char buf[1024] = {0}, buf2[1024] = {0};
char *sendBuf = NULL;
socklen_t len;
fd_set t_set1; fd_set t_set1;
struct timeval tv; struct timeval tv;
int registerType = 0; int registerType = 0;
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
#include "cJSON.h" #include "cJSON.h"
#include "com_api.h" #include "com_api.h"
#include "kk_log.h" #include "kk_log.h"
#include "kk_hal.h"
#include "mqtt_api.h"
const char KK_URI_SYS_PREFIX[] = "biz/kk/%s/%s/thing/service/property/set"; const char KK_URI_SYS_PREFIX[] = "biz/kk/%s/%s/thing/service/property/set";
const char KK_URI_SYS_PREFIX_SERVICE[] = "biz/kk/%s/%s/thing/service/+"; const char KK_URI_SYS_PREFIX_SERVICE[] = "biz/kk/%s/%s/thing/service/+";
...@@ -20,6 +21,7 @@ static int s_gw_status = DEVICE_OFFLINE; ...@@ -20,6 +21,7 @@ static int s_gw_status = DEVICE_OFFLINE;
int kk_set_gw_status(int status) int kk_set_gw_status(int status)
{ {
s_gw_status = status; s_gw_status = status;
return 0;
} }
int kk_get_gw_status(void) int kk_get_gw_status(void)
{ {
...@@ -31,7 +33,7 @@ int KK_Subdev_Subscribe(const cJSON *root) ...@@ -31,7 +33,7 @@ int KK_Subdev_Subscribe(const cJSON *root)
cJSON *deviceCode = NULL; cJSON *deviceCode = NULL;
cJSON *productCode = NULL; cJSON *productCode = NULL;
cJSON *data = NULL; cJSON *data = NULL;
cJSON *cmd = NULL; //cJSON *cmd = NULL;
int url_len = 0; int url_len = 0;
data = cJSON_GetObjectItem(root, "data"); data = cJSON_GetObjectItem(root, "data");
...@@ -76,7 +78,7 @@ int KK_Subdev_Subscribe(const cJSON *root) ...@@ -76,7 +78,7 @@ int KK_Subdev_Subscribe(const cJSON *root)
static int _kk_ccu_topic_subscribe(char productCode[PRODUCT_CODE_LEN],char deviceCode[DEVICE_CODE_LEN]) static int _kk_ccu_topic_subscribe(char productCode[PRODUCT_CODE_LEN],char deviceCode[DEVICE_CODE_LEN])
{ {
int res = 0, index = 0, fail_count = 0; int res = 0;
int url_len = 0; int url_len = 0;
url_len = strlen(KK_URI_SYS_PREFIX_SERVICE) + strlen(productCode)+strlen(deviceCode) + 1; url_len = strlen(KK_URI_SYS_PREFIX_SERVICE) + strlen(productCode)+strlen(deviceCode) + 1;
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
#include "mqtt_api.h" #include "mqtt_api.h"
#include "com_api.h" #include "com_api.h"
#include "kk_product.h" #include "kk_product.h"
#include "kk_hal.h"
static const char* OPT_SEND = "MQTTAsync_sendMessage"; static const char* OPT_SEND = "MQTTAsync_sendMessage";
static const char* OPT_SUB = "MQTTAsync_subscribe"; static const char* OPT_SUB = "MQTTAsync_subscribe";
static const char* OPT_UNSUB = "MQTTAsync_unsubscribe"; static const char* OPT_UNSUB = "MQTTAsync_unsubscribe";
static MQTTAsync s_Client; static MQTTAsync s_Client;
static int s_mqttStop = 0; static int s_mqttStop = 0;
static int s_cloudStatus = DEVICE_OFFLINE; static int s_cloudStatus = DEVICE_OFFLINE;
int KK_Send_CloudState(int state);
int kk_get_cloud_status(void){ int kk_get_cloud_status(void){
return s_cloudStatus; return s_cloudStatus;
} }
...@@ -129,7 +129,6 @@ static void onDeliveryComplete(void* context, MQTTAsync_token token) ...@@ -129,7 +129,6 @@ static void onDeliveryComplete(void* context, MQTTAsync_token token)
} }
static void onConnectBuild(void *context, char *cause) static void onConnectBuild(void *context, char *cause)
{ {
int rc = 0;
INFO_PRINT("onConnectBuild:%s \n",cause); INFO_PRINT("onConnectBuild:%s \n",cause);
//rc = KK_Client_Gateway_Subscribe(); //rc = KK_Client_Gateway_Subscribe();
//if(rc != 0) //if(rc != 0)
......
...@@ -15,6 +15,6 @@ extern int KK_MQTT_RecvMsg(const char *topicName,const char *payload); ...@@ -15,6 +15,6 @@ extern int KK_MQTT_RecvMsg(const char *topicName,const char *payload);
extern int KK_MQTT_UnsubTopic(const char *topicName); extern int KK_MQTT_UnsubTopic(const char *topicName);
extern MQTTAsync KK_MQTT_Connect(void); extern MQTTAsync KK_MQTT_Connect(void);
int kk_get_cloud_status(void);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment