Commit ffa4dc00 authored by 尹佳钦's avatar 尹佳钦
parents a66362ff f3ef7fc4
......@@ -6,6 +6,8 @@
#define GW2CCU_PIPE "tcp://%s:5555"
#define GW2CCU_PUBSUB "tcp://%s:5557"
#define MAGIC "magic12"
#define MAGIC_ACK "magic12ack"
#define FILTERSTR "|"
#ifndef _ZLOG_
......@@ -36,6 +38,7 @@ typedef struct {
ipc_cb* cb;
ipc_type type;
int isconnect;
int sendErrCnt;
}Bloop_ctrl_t;
......@@ -84,10 +87,12 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
}
if (bytes <= 0 || dat == NULL) {
ERROR_PRINT(" recived data is null or len is 0 \n");
ERROR_PRINT("nn_recv failed with error code %d, %s \n", nn_errno(), nn_strerror(nn_errno ()));
return;
}
INFO_PRINT("watcher_cb:%s recived\r\n\r\n", (char *)dat);
loop_ctrl->isconnect = 1;
//if sub, need filter sbuscribe str
if (IPC_PLAT2MID == loop_ctrl->type || IPC_MID2PLAT == loop_ctrl->type){
validDat = _parse_data_by_subscribe(dat, bytes, &validLen, &chlMark);
......@@ -106,10 +111,13 @@ static void watcher_cb (struct ev_loop *loop ,struct ev_io *w, int revents)
}
}*/
if (strncmp(validDat,MAGIC, strlen(MAGIC)) == 0){
if (loop_ctrl->isconnect == 0){
kk_ipc_send_ex(loop_ctrl->type, validDat, bytes, chlMark);
loop_ctrl->isconnect =1;
if (strncmp(validDat,MAGIC_ACK, strlen(MAGIC_ACK)) == 0){
}else{
kk_ipc_send_ex(loop_ctrl->type, MAGIC_ACK, strlen(MAGIC_ACK)+1, chlMark);
}
loop_ctrl->isconnect =1;
nn_freemsg(dat);
return;
}else if (IPC_MID2PLAT == loop_ctrl->type){//
......@@ -335,7 +343,7 @@ int kk_ipc_init(ipc_type type, ipc_cb cb, char* chlMark, char* ip)
}
int kk_ipc_dinit(ipc_type type)
int kk_ipc_deinit(ipc_type type)
{
Bloop_ctrl_t* loop_ctrl;
if (Bloop_ctrl.type == type){
......@@ -389,10 +397,11 @@ int kk_ipc_send(ipc_type type, void* data, int len)
int kk_ipc_send_ex(ipc_type type, void* data, int len, char* chalMark)
{
int ret = 0;
if (data != NULL){
int filterlen = 0;
void* buf = NULL;
Bloop_ctrl_t* loop_ctrl;
if (chalMark != NULL){
filterlen = strlen(chalMark) + strlen(FILTERSTR);
......@@ -410,9 +419,21 @@ int kk_ipc_send_ex(ipc_type type, void* data, int len, char* chalMark)
memcpy(buf + filterlen, data, len);
if (type == IPC_MID2PLAT){
nn_send(Mloop_ctrl.ab.n, &buf, NN_MSG, NN_DONTWAIT);//NN_DONTWAIT
loop_ctrl = &Mloop_ctrl;
ret =nn_send(Mloop_ctrl.ab.n, &buf, NN_MSG, NN_DONTWAIT);//NN_DONTWAIT
}else{
loop_ctrl = &Bloop_ctrl;
ret = nn_send(Bloop_ctrl.ba.n, &buf, NN_MSG, NN_DONTWAIT);
}
if (ret < 0){
ERROR_PRINT("nn_send failed with error code %d, str=%s \n", nn_errno(), nn_strerror(nn_errno()));
loop_ctrl->sendErrCnt++;
loop_ctrl->isconnect = 0;
nn_freemsg(buf);
}else{
nn_send(Bloop_ctrl.ba.n, &buf, NN_MSG, NN_DONTWAIT);
loop_ctrl->sendErrCnt = 0;
loop_ctrl->isconnect = 1;
}
}
......@@ -421,6 +442,18 @@ int kk_ipc_send_ex(ipc_type type, void* data, int len, char* chalMark)
}
int kk_ipc_get_senderrcnt(ipc_type type){
Bloop_ctrl_t* loop_ctrl;
if (IPC_MID2PLAT == type){
loop_ctrl = &Mloop_ctrl;
}else {
loop_ctrl = &Bloop_ctrl;
}
return loop_ctrl->sendErrCnt;
}
int kk_ipc_isconnect(ipc_type type){
Bloop_ctrl_t* loop_ctrl;
......@@ -430,9 +463,8 @@ int kk_ipc_isconnect(ipc_type type){
loop_ctrl = &Bloop_ctrl;
}
if (loop_ctrl->isconnect == 1){
return 1;
}else{
loop_ctrl->isconnect = 0;
{
for(int i =0; i<20;i++){
kk_ipc_send(type, MAGIC, strlen(MAGIC)+1);
......
......@@ -40,7 +40,7 @@ typedef enum {
typedef void ipc_cb(void* data, int len, char* chalMark);
int kk_ipc_init(ipc_type type, ipc_cb cb, char* chalMark, char* ip);
int kk_ipc_dinit();
int kk_ipc_deinit();
int kk_ipc_send(ipc_type type, void* data, int len);
int kk_ipc_send_ex(ipc_type type, void* data, int len, char* chalMark);
......
......@@ -193,8 +193,8 @@ int kk_is_tcp_channel(char devCode[DEVICE_CODE_LEN]){
for(;i < MAX_LISTEN_NUM; i++){
if(strcmp(devCode, g_tcp_ctrl[i].deviceCode) == 0){
printf("[%s] idx=%d ip=%s sock=%d\n", __FUNCTION__,i, devCode, g_tcp_ctrl[i].sock);
return i;
printf("[%s] idx=%d ip=%s sock=%d\n", __FUNCTION__,i, g_tcp_ctrl[i].ip, g_tcp_ctrl[i].sock);
return g_tcp_ctrl[i].sock;
}
}
return -1;
......
......@@ -196,7 +196,7 @@ int dm_mgr_device_create(_IN_ int dev_type,_IN_ char productCode[PRODUCT_CODE_MA
memset(node, 0, sizeof(dm_mgr_dev_node_t));
if(dev_type == KK_DM_DEVICE_CCU)
node->devid = 0;
node->devid = KK_DM_DEVICE_CCU_DEVICEID;
else
node->devid = _dm_mgr_next_devid();
node->dev_type = dev_type;
......@@ -1302,7 +1302,10 @@ int dm_mgr_subdev_delete(_IN_ char deviceCode[DEVICE_CODE_MAXLEN])
{
int res = 0;
dm_mgr_dev_node_t *node = NULL;
if(deviceCode == NULL || strlen(deviceCode) <=0){
ERROR_PRINT("ERROR [%s][%d] res:%d\n",__FUNCTION__,__LINE__,res);
return FAIL_RETURN;
}
INFO_PRINT("dm_mgr_subdev_delete deviceCode:%s\n",deviceCode);
res = kk_subDev_delete_by_dcode(deviceCode);//delete sub db data
if (res != SUCCESS_RETURN) {
......
......@@ -16,6 +16,8 @@
#define KK_DM_GW_DEVICE_PRODUCT_TYPE "gw"
#define KK_DM_GW_DEVICE_PRODUCT_CODE "2"
#define KK_DM_DEVICE_CCU_DEVICEID (0x00)
typedef struct {
int devid;
int dev_type;
......
......@@ -765,6 +765,7 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
dm_mgr_dev_node_t *node = NULL;
kk_tsl_data_t *property = NULL;
cJSON *propertyItem = NULL;
char tmpValue[20] = {0};
if(params == NULL || deviceCode == NULL){
return FAIL_RETURN;
}
......@@ -773,6 +774,8 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
if (res != SUCCESS_RETURN) {
return FAIL_RETURN;
}
//printf("dm_msg_thing_property_post_by_identify:%s\n",params->valuestring);
nums = node->dev_shadow->property_number;
for(idx = 0; idx < nums; idx++){
property = (kk_tsl_data_t *)(node->dev_shadow->properties + idx);
......@@ -781,9 +784,36 @@ int dm_msg_thing_property_post_by_identify(char *deviceCode,cJSON *params)
}
propertyItem = cJSON_GetObjectItem(params, property->identifier);
if(propertyItem != NULL){
kk_tsl_post_property(node->devid,property->identifier,0);
//kk_tsl_post_property(node->devid,property->identifier,0);
/*update the db data */
if(property->data_value.type == KK_TSL_DATA_TYPE_INT ||
property->data_value.type == KK_TSL_DATA_TYPE_ENUM||
property->data_value.type == KK_TSL_DATA_TYPE_BOOL){
sprintf(tmpValue,"%d",property->data_value.value_int);
kk_property_db_update_value(deviceCode,property->identifier,tmpValue);
}
else if(property->data_value.type == KK_TSL_DATA_TYPE_FLOAT){
sprintf(tmpValue,"%d",property->data_value.value_float);
kk_property_db_update_value(deviceCode,property->identifier,tmpValue);
}
else if(property->data_value.type == KK_TSL_DATA_TYPE_DOUBLE){
sprintf(tmpValue,"%d",property->data_value.value_double);
kk_property_db_update_value(deviceCode,property->identifier,tmpValue);
}
else if(property->data_value.type == KK_TSL_DATA_TYPE_TEXT||
property->data_value.type == KK_TSL_DATA_TYPE_DATE){
kk_property_db_update_value(deviceCode,property->identifier,property->data_value.value);
}
else{
ERROR_PRINT("Unkonwn Number Type");
}
}
}
char* outstr = cJSON_Print(params);
dm_mgr_upstream_thing_property_post(node->devid,outstr,strlen(outstr),0);
free(outstr);
return SUCCESS_RETURN;
}
......
......@@ -48,6 +48,9 @@ const char DM_MSG_INFO[] DM_READ_ONLY;
#define KK_THING_SERVICE_PROPERTY_SET "/thing/service/property/set"
#define KK_THING_OTA_DEVICE_UPGRADE "/ota/device/upgrade"
#define KK_THING_CLOUDSTATE_MSG "/thing/ccu/cloudstate_reply"
#define KK_THING_TOPO_ADD_MSG "/thing/topo/add"
#define KK_THING_PROPERTY_POST "property/post"
#define KK_THING_TOPO_DELETE_MSG "/thing/topo/delete"
//const char DM_URI_SYS_PREFIX[] DM_READ_ONLY = "/sys/%s/%s/";
......
......@@ -317,9 +317,9 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
}
kk_property_db_update("CCU_66666");
if(s_CloudStatus){
iotx_dm_dev_online(0);//first online,report the online status
iotx_dm_dev_online(KK_DM_DEVICE_CCU_DEVICEID);//first online,report the online status
usleep(200000);
kk_tsl_post_property(0,NULL,0);
kk_tsl_post_property(KK_DM_DEVICE_CCU_DEVICEID,NULL,0);
}
}else if (strstr(typeJson->valuestring,KK_THING_OTA_DEVICE_UPGRADE)){
INFO_PRINT("ota upgrade... \n");
......
......@@ -272,7 +272,6 @@ int kk_property_db_get_rawdata(const char *identifier,const int dev_type, kk_pro
return SUCCESS_RETURN;
}
int kk_property_db_update(const char *deviceCode)
{
int res = 0;
......
......@@ -177,17 +177,17 @@ void kk_platMsg_handle(void* data, char* chalMark){
WARNING_PRINT("Error before: [%s]\n","cJSON_Parse");
}
else{
info = cJSON_GetObjectItem(json, "info");
payload = cJSON_GetObjectItem(json, "payload");
info = cJSON_GetObjectItem(json, MSG_INFO_STR);
payload = cJSON_GetObjectItem(json, MSG_PAYLOAD_STR);
if (info == NULL || payload == NULL){
ERROR_PRINT("info or payload params error\n");
goto error;
}
msgType = cJSON_GetObjectItem(info, "msgType");
info_dcode = cJSON_GetObjectItem(info, "deviceCode");
msgType = cJSON_GetObjectItem(info, MSG_TYPE_STR);
info_dcode = cJSON_GetObjectItem(info, MSG_DEVICE_CODE_STR);
jsonPay = cJSON_GetObjectItem(payload, "params");
jsonPay = cJSON_GetObjectItem(payload, MSG_PARAMS_STR);
if (msgType == NULL || info_dcode == NULL || jsonPay == NULL){
ERROR_PRINT("msgType info_dcode or jsonPay params are error\n");
......@@ -200,9 +200,9 @@ void kk_platMsg_handle(void* data, char* chalMark){
dm_mgr_update_timestamp_by_devicecode(info_dcode->valuestring,HAL_UptimeMs());
if (strcmp(msgType->valuestring, "/thing/topo/add")==0){
proCode = cJSON_GetObjectItem(jsonPay, "productCode");
devCode = cJSON_GetObjectItem(jsonPay, "deviceCode");
if (strcmp(msgType->valuestring, KK_THING_TOPO_ADD_MSG)==0){
proCode = cJSON_GetObjectItem(jsonPay, MSG_PRODUCT_CODE_STR);
devCode = cJSON_GetObjectItem(jsonPay, MSG_DEVICE_CODE_STR);
mac = cJSON_GetObjectItem(jsonPay, "mac");
if (proCode == NULL || devCode == NULL || mac == NULL){
ERROR_PRINT("productCode, deviceCode mac params are error\n");
......@@ -218,21 +218,19 @@ void kk_platMsg_handle(void* data, char* chalMark){
kk_mid_subdev_add(KK_DM_DEVICE_SUBDEV,proCode->valuestring,devCode->valuestring, mac->valuestring,info_dcode->valuestring);
}
}else if (strstr(msgType->valuestring, "property/post") != NULL){
}else if (strstr(msgType->valuestring, KK_THING_PROPERTY_POST) != NULL){
INFO_PRINT("save property and send to cloud \n");
char* outstr = cJSON_Print(payload);
kk_tsl_property_set_by_devicecode(info_dcode->valuestring, outstr, strlen(outstr)+1);
dm_msg_thing_property_post_by_identify(info_dcode->valuestring,jsonPay);
kk_property_db_update(info_dcode->valuestring);
free(outstr);
}else if(strstr(msgType->valuestring, "/thing/topo/delete") != NULL){
}else if(strstr(msgType->valuestring, KK_THING_TOPO_DELETE_MSG) != NULL){
INFO_PRINT("kk_platMsg_handle data: handle delete\n");
devCode = cJSON_GetObjectItem(jsonPay, "deviceCode");
devCode = cJSON_GetObjectItem(jsonPay, MSG_DEVICE_CODE_STR);
kk_ipc_send(IPC_MID2APP,data,strlen(data));
dm_mgr_subdev_delete(devCode->valuestring);
}else{
INFO_PRINT("kk_platMsg_handle data: don't handle it [%s]\n",data);
......@@ -603,7 +601,7 @@ void *ccu_property_monitor(void *args)
}
if(needReport&&(kk_get_cloudstatus() == 1)){
needReport = 0;
kk_tsl_post_property(0,NULL,0);
kk_tsl_post_property(KK_DM_DEVICE_CCU_DEVICEID,NULL,0);
}
sleep(time_second);
}
......
......@@ -1259,6 +1259,7 @@ int kk_tsl_property_set_by_devicecode(const char deviceCode[DEVICE_CODE_MAXLEN],
/* Operation */
res = _kk_msg_property_set(devid, &request);
/* Response */
//kk_tsl_post_property(devid,NULL);
......
......@@ -28,7 +28,6 @@ typedef enum {
IPC_UNDEF
} ipc_type;
#define MSG_TYPE_STR "msgtype"
#define MSG_PRODUCT_TYPE_STR "productType"
#define MSG_PRODUCT_CODE_STR "productCode"
......@@ -36,10 +35,12 @@ typedef enum {
#define MSG_PAYLOAD_STR "payload"
#define MSG_INFO_STR "info"
#define MSG_INDENTIFIER_STR "identifier"
#define MSG_PARAMS_STR "params"
#define MSG_IOTClOUDSTATE_STR "IOTCloudState"
typedef void ipc_cb(void* data, int len, char* chalMark);
int kk_ipc_init(ipc_type type, ipc_cb cb, char* chalMark, char* ip);
int kk_ipc_dinit();
int kk_ipc_deinit();
int kk_ipc_send(ipc_type type, void* data, int len);
int kk_ipc_send_ex(ipc_type type, void* data, int len, char* chalMark);
......
......@@ -87,6 +87,7 @@ cJSON * test_func(jrpc_context * ctx, cJSON * params, cJSON *id) {
static int send_result_resp(cJSON * result,
cJSON * id) {
#if 0
int return_value = 0;
cJSON *info_root = rpc_cJSON_CreateObject();
if(info_root){
......@@ -115,11 +116,15 @@ static int send_result_resp(cJSON * result,
free(str_result);
rpc_cJSON_Delete(result_root);
return return_value;
#else
return 0;
#endif
}
static int send_error_resp(int code, char* message,
cJSON * id) {
#if 0
int return_value = 0;
cJSON *edata;
......@@ -155,6 +160,9 @@ static int send_error_resp(int code, char* message,
rpc_cJSON_Delete(result_root);
free(message);
return return_value;
#else
return 0;
#endif
}
static int invoke_procedure(struct jrpc_server *server,
......@@ -266,6 +274,21 @@ int _init_param(struct jrpc_server *server) {
return 0;
}
char g_mac[19] = {0};
char* kk_get_gw_mac(){
int cnt = 0;
EmberEUI64 eui64;
emberAfGetEui64(eui64);
while(eui64[0] ==0 && eui64[1] ==0 && eui64[2] == 0 && cnt++ < 3){
sleep(1);
}
if (eui64[0] ==0 && eui64[1] ==0 && eui64[2] == 0){
printf("get gw mac error !!! \n");
return NULL;
}
rpc_eui64ToString(eui64,g_mac);
return g_mac;
}
int search_ccu(char devcode[33], char ip[16], int* port){
......@@ -283,7 +306,14 @@ int search_ccu(char devcode[33], char ip[16], int* port){
struct sockaddr_in Addrto;
struct sockaddr_in AddrRev;
sprintf(sendMessage,sendCmdFmt,GW_DEVICE_CODE,GW2CCU_PROTOCOL);
char* macString = kk_get_gw_mac();
if (macString == NULL){
printf("[%s] get mac fail\n",__FUNCTION__);
return -1;
}
sprintf(sendMessage,sendCmdFmt,macString/*GW_DEVICE_CODE*/,GW2CCU_PROTOCOL);
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
{
printf("[%s] socket fail\n",__FUNCTION__);
......@@ -425,13 +455,17 @@ int search_ccu(char devcode[33], char ip[16], int* port){
}
#define GW_PRODUCT_CODE "2"
#define GW_MAC GW_DEVICE_CODE
void* _msg_topo_add(){
char msgFmt[] = "{\"info\":{\"msgtype\":\"/thing/topo/add\",\"productCode\":\"%s\",\"deviceCode\":\"%s\"},\
\"payload\":{\"msgId\":\"%d\",\"version\":\"1.0\",\"params\":{\"deviceCode\":\"%s\",\"productCode\":\"%s\",\"mac\":\"%s\"}}}";
char msg[520] = {0};
sprintf(msg, msgFmt, GW_PRODUCT_CODE, GW_DEVICE_CODE, 1, GW_DEVICE_CODE, GW_PRODUCT_CODE,GW_MAC);
char* macString = kk_get_gw_mac();
if (macString == NULL){
printf("[%s] get mac fail\n",__FUNCTION__);
return NULL;
}
sprintf(msg, msgFmt, GW_PRODUCT_CODE, macString, 1, macString, GW_PRODUCT_CODE,macString);
cJSON* msgObj = cJSON_Parse(msg);
char* outbuf = cJSON_Print(msgObj);
cJSON_Delete(msgObj);
......@@ -447,8 +481,13 @@ void* _msg_event_property_post(char ip[16], int port){
\"time\":1524448722000,\"method\":\"thing.event.property.post\"}\
}";
char msg[620] = {0};
sprintf(msg, msgFmt, GW_PRODUCT_CODE, GW_DEVICE_CODE,
1, 0, 0, 0, "12345", ip,GW_MAC,port);
char* macString = kk_get_gw_mac();
if (macString == NULL){
printf("[%s] get mac fail\n",__FUNCTION__);
return NULL;
}
sprintf(msg, msgFmt, GW_PRODUCT_CODE, macString,
1, 0, 0, 0, "12345", ip,macString,port);
cJSON* msgObj = cJSON_Parse(msg);
char* outbuf = cJSON_Print(msgObj);
cJSON_Delete(msgObj);
......@@ -456,6 +495,16 @@ void* _msg_event_property_post(char ip[16], int port){
}
int kk_connect_check(){
if(strcmp(GW2CCU_PROTOCOL, "tcp") == 0){
return kk_get_retry_num() > 20;
}else{
if (kk_ipc_get_senderrcnt(IPC_PLAT2MID) > 0){
return kk_ipc_isconnect(IPC_PLAT2MID)==0?1:0;
}
return 0;
}
}
void ipcHandle(void)
{
......@@ -465,10 +514,15 @@ void ipcHandle(void)
emberAfAppPrint( "Thread rpc Interface Parse create\n" );
search_ccu(deviceCode, ip, &port);
_init_param(&my_server);
char* macString = kk_get_gw_mac();
if (macString == NULL){
printf("[%s] get mac fail, exit pthread !!!!!!!!!!!!!!!!!\n",__FUNCTION__);
return;
}
if(strcmp(GW2CCU_PROTOCOL, "tcp") == 0){
kk_tcp_client_init(ip, port, _cb);
}else{
kk_ipc_init(IPC_PLAT2MID, _cb, GW_DEVICE_CODE, ip);
kk_ipc_init(IPC_PLAT2MID, _cb, macString, ip);
}
emberAfAppPrint("sizeof(rpc_table)=%d,sizeof(rpc_table_s)=%d,%d\n",sizeof(rpc_table),sizeof(rpc_table_s),sizeof(rpc_table)/sizeof(rpc_table_s));
......@@ -479,6 +533,11 @@ void ipcHandle(void)
//send add gw to ccu
char* outbuf = _msg_topo_add();
if (outbuf == NULL){
printf("[%s] topo add msg failed, exit\n",__FUNCTION__);
return;
}
if (strcmp(GW2CCU_PROTOCOL, "tcp") != 0){
printf("check nanomsg is connect(%d) \n", kk_ipc_isconnect(IPC_PLAT2MID));
}
......@@ -493,11 +552,41 @@ void ipcHandle(void)
cnt++;
if (cnt == 2){
sleep(1);
char* postmsg = _msg_event_property_post(ip,port);
char gwIp[17] = {0};
HAL_Get_IP(gwIp,NULL);
char* postmsg = _msg_event_property_post(gwIp,port);
if (outbuf == NULL){
printf("[%s] property_post msg failed\n",__FUNCTION__);
continue;
}
kk_sendData2CCU(postmsg, strlen(postmsg));
free(postmsg);
}
if (kk_connect_check()){
//discover ccu
search_ccu(deviceCode, ip, &port);
if(strcmp(GW2CCU_PROTOCOL, "tcp") == 0){
kk_tcp_client_init(ip, port, _cb);
}else{
kk_ipc_deinit(IPC_PLAT2MID);
kk_ipc_init(IPC_PLAT2MID, _cb, macString/*GW_DEVICE_CODE*/, ip);
}
//send add gw to ccu
outbuf = _msg_topo_add();
if (outbuf == NULL){
printf("[%s] topo add msg failed, exit\n",__FUNCTION__);
return;
}
kk_sendData2CCU(outbuf, strlen(outbuf));
free(outbuf);
cnt = 0;
kk_reset_retry_num();
}
}
//jrpc_server_run(&my_server);
......
......@@ -486,7 +486,7 @@ void emAfDeviceTableLoad(void)
deviceTable[i].clusterOutStartPosition = (uint16_t) data;
deviceTable[i].state = EMBER_AF_PLUGIN_DEVICE_TABLE_STATE_JOINED;
kk_sub_tsl_add(deviceTable[i].eui64,TEST_PRODUCT_CODE);
//kk_sub_tsl_add(deviceTable[i].eui64,TEST_PRODUCT_CODE);
}
deviceTable[i].lastMsgTimestamp = halCommonGetInt32uMillisecondTick();
......
......@@ -503,7 +503,7 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
kk_print("*******************123****************\r\n");
kk_print_info("\r\n-----hello world![%s:%s]-----\r\n",__DATE__,__TIME__);
kk_print_version();
kk_tsl_init();
emberSerialInit(APP_SERIAL, BAUD_RATE, PARITY_NONE, 1); //fock child process
emberAfAppPrintln("Reset info: %d (%p)",
......@@ -542,7 +542,8 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
emberAfGetEui64(eui64);
emberAfCorePrintln("~~~~~~~~~~~~~~~~~~~~~NCP MAC:");
emberAfPrintBigEndianEui64(eui64);
//kk_network_check();
kk_tsl_init(eui64);
pthread_t tid;
......@@ -556,6 +557,7 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
EmberNetworkStatus Status = ezspNetworkState();
kk_print("ezspNetworkState()~~~~~~[%d]\r\n",Status);
// main loop
......
#! /bin/bash
export LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):./lib/
./midware &
./kcloud &
./Z3GatewayHost &
.PHONY: doc detect config reconfig toolchain sub-mods final-out env cmake one help
.PHONY: doc detect config reconfig toolchain sub-mods final-out env cmake one help package
all: detect config toolchain sub-mods final-out
$(TOP_Q) \
......@@ -193,6 +193,31 @@ distclean:
fi \
fi
buildDate=$(shell date "+%Y.%m.%d")
releaseDir=release$(buildDate)
package:
@echo "$(buildDate)"
echo "$(releaseDir)"
rm -rf $(releaseDir)
mkdir $(releaseDir)
mkdir $(releaseDir)/lib
mkdir $(releaseDir)/tsl
cp zlog.conf $(TOP_DIR)/$(releaseDir)
-cp -rf $(TOP_DIR)/tsl $(TOP_DIR)/$(releaseDir)/tsl
cp -rf $(TOP_DIR)/output/release/lib/*.so $(TOP_DIR)/$(releaseDir)/lib
cp -rf $(TOP_DIR)/output/release/bin/* $(TOP_DIR)/$(releaseDir)/
cp -rf $(TOP_DIR)/run.sh $(TOP_DIR)/$(releaseDir)/
ifeq ($(CONFIG_VENDOR),ubuntu)
cp -rf $(TOP_DIR)/common/nanomsg/libnanomsg_ubuntu.so $(TOP_DIR)/$(releaseDir)/lib/libnanomsg.so.5
cp -rf $(TOP_DIR)/common/ev/libev_ubuntu.so $(TOP_DIR)/$(releaseDir)/lib
else
cp -rf $(TOP_DIR)/common/nanomsg/libnanomsg.so $(TOP_DIR)/$(releaseDir)/lib
cp -rf $(TOP_DIR)/common/ev/libev.so $(TOP_DIR)/$(releaseDir)/lib
endif
cp -rf $(TOP_DIR)/platform/zigbee/app/builder/Z3GatewayHost/build/exe/Z3GatewayHost $(TOP_DIR)/$(releaseDir)/
echo $(PWD)
ifeq ($(shell uname),Darwin)
KCONFIG_MCONF := tools/prebuilt/macos/kconfig-frontends-mac/kconfig-mconf
else
......
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