Commit 2f74adb5 authored by 陈伟灿's avatar 陈伟灿

Merge branch 'yjq' into 'master'

Yjq

See merge request chenweican/k-sdk!32
parents c1141a95 2a4c6f81
{
"mapTable": [
{
"modleId": "00068611",
"productCode": "3001",
"productName": "星辰系列.白色零火线单路灯控面板Z3S(KONKE)"
},{
"modleId": "00068612",
"productCode": "3002",
"productName": "星辰系列.白色零火线双路灯控面板Z3S(KONKE)"
},{
"modleId": "00068613",
"productCode": "3003",
"productName": "星辰系列.白色零火线三路灯控面板Z3S(KONKE)"
},{
"modleId": "00048611",
"productCode": "3004",
"productName": "星辰系列.白色零火线情景面板Z3S(KONKE)"
},{
"modleId": "00038611",
"productCode": "3005",
"productName": "星辰系列.白色零火线单路窗帘面板Z3S(KONKE)"
},{
"modleId": "00038612",
"productCode": "3006",
"productName": "星辰系列.白色零火线双路窗帘面板Z3S(KONKE)"
},{
"modleId": "00038613",
"productCode": "3007",
"productName": "星辰系列·白色干触点单路窗帘面板Z3S(KONKE)"
},{
"modleId": "00038614",
"productCode": "3008",
"productName": "星辰系列·白色干触点双路窗帘面板Z3S(KONKE)"
},{
"modleId": "00068601",
"productCode": "3009",
"productName": "铂金系列.白色零火线单路灯控面板Z3S(KONKE)"
},{
"modleId": "00068602",
"productCode": "3010",
"productName": "铂金系列.白色零火线双路灯控面板Z3S(KONKE)"
},{
"modleId": "00068603",
"productCode": "3011",
"productName": "铂金系列.白色零火线三路灯控面板Z3S(KONKE)"
},{
"modleId": "00038601",
"productCode": "3012",
"productName": "铂金系列.白色零火线窗帘面板Z3S(KONKE)"
},{
"modleId": "00048601",
"productCode": "3013",
"productName": "铂金系列.白色零火线情景面板Z3S(KONKE)"
},{
"modleId": "00048602",
"productCode": "3014",
"productName": "铂金系列.白色快捷面板Z3S(KONKE)"
},{
"modleId": "0402812C",
"productCode": "3016",
"productName": "铂金系列.白色紧急呼叫按钮Z3S(KONKE)"
},{
"modleId": "0402802C",
"productCode": "3015",
"productName": "铂金系列.白色零火线SOS紧急呼叫面板Z3S(KONKE)"
},{
"modleId": "00038603",
"productCode": "3017",
"productName": "铂金系列.白色零火线推窗器面板Z3S(KONKE)"
},{
"modleId": "01018601",
"productCode": "3018",
"productName": "铂金系列.白色零火线调光面板Z3S(KONKE)"
},{
"modleId": "3019",
"productCode": "00518610",
"productName": "铂金系列.白色10A智能插座Z3S(KONKE)"
},{
"modleId": "00518616",
"productCode": "3020",
"productName": "铂金系列.白色16A智能插座Z3S(KONKE)"
},{
"modleId": "00038602",
"productCode": "3021",
"productName": "铂金系列·白色干触点窗帘面板Z3S(安心加)"
},{
"modleId": "00068621",
"productCode": "3022",
"productName": "肖邦系列.白色零火线单路灯控面板Z3S(KONKE)"
},{
"modleId": "00068622",
"productCode": "3023",
"productName": "肖邦系列.白色零火线双路灯控面板Z3S(KONKE)"
},{
"modleId": "00068623",
"productCode": "3024",
"productName": "肖邦系列.白色零火线三路灯控面板Z3S(KONKE)"
},{
"modleId": "00048621",
"productCode": "3025",
"productName": "肖邦系列.白色零火线情景面板Z3S(KONKE)"
},{
"modleId": "00038621",
"productCode": "3026",
"productName": "肖邦系列.白色零火线单路窗帘面板Z3S(KONKE)"
},{
"modleId": "00038622",
"productCode": "3027",
"productName": "肖邦系列.白色零火线双路窗帘面板Z3S(KONKE)"
},{
"modleId": "00518620",
"productCode": "3037",
"productName": "肖邦系列.白色10A智能插座Z3S(KONKE)"
},{
"modleId": "00518626",
"productCode": "3038",
"productName": "肖邦系列.白色16A智能插座Z3S(KONKE)"
},{
"modleId": "0402002A",
"productCode": "3039",
"productName": "水浸传感器-HZB30S版(KONKE)"
},{
"modleId": "0402002B",
"productCode": "3040",
"productName": "燃气报警器-HZ3S版(KONKE)"
},{
"modleId": "04020028",
"productCode": "3041",
"productName": "烟雾报警器-HZ3S版(KONKE)"
},{
"modleId": "3041",
"productCode": "3080",
"productName": "燃气报警器-豪恩版(iHORN)"
},{
"modleId": "3050",
"productCode": "3081",
"productName": "烟雾报警器-豪恩版(iHORN)"
},{
"modleId": "3043",
"productCode": "0402010D",
"productName": "红外幕帘探测器HZ3S版(KONKE)"
},{
"modleId": "03020001",
"productCode": "3076",
"productName": "环境传感器KZ3S(KONKE)"
},{
"modleId": "00510001",
"productCode": "3046",
"productName": "KIT系列.白色快捷情景按钮"
},{
"modleId": "03020000",
"productCode": "3048",
"productName": "KIT系列.白色温湿度传感器"
},{
"modleId": "0402000D",
"productCode": "1035",
"productName": "KIT系列.白色人体传感器"
},{
"modleId": "04020015",
"productCode": "3050",
"productName": "KIT系列.白色门窗传感器"
},{
"modleId": "04021015",
"productCode": "3051",
"productName": "邦德系列.白色门窗传感器(KONKE)"
},{
"modleId": "0402102C",
"productCode": "3054",
"productName": "邦德系列.白色SOS按钮(KONKE)"
},{
"modleId": "0402102A",
"productCode": "3055",
"productName": "邦德系列.白色水浸传感器(KONKE)"
},{
"modleId": "00040002",
"productCode": "3056",
"productName": "邦德系列.白色快捷按键(KONKE)"
},{
"modleId": "04031225",
"productCode": "3057",
"productName": "邦德系列.白色声光传感器(KONKE)"
},{
"modleId": "02020000",
"productCode": "3067",
"productName": "智能窗帘电机Z3S(KONKE)(说明:杜亚款)"
},{
"modleId": "02020001",
"productCode": "3068",
"productName": "威刚系列.智能窗帘电机Z3S(KONKE)(说明:威士达款)"
},{
"modleId": "01000002",
"productCode": "3069",
"productName": "双路智能灯控模块Z3S(KONKE)"
},{
"modleId": "04028301",
"productCode": "3070",
"productName": "传感器模块Z3S(KONKE)"
},{
"modleId": "03300001",
"productCode": "3071",
"productName": "智能水阀控制器Z3S(KONKE)"
},{
"modleId": "03310001",
"productCode": "3072",
"productName": "智能燃气机械臂控制器Z3S(KONKE)"
},{
"modleId": "01020001",
"productCode": "3073",
"productName": "幻彩灯带控制器Z3S(KONKE)"
},{
"modleId": "00648631",
"productCode": "3077",
"productName": "多功能面板(亚运村临时项目)"
}
]
}
{
"productCode":"1008",
"config":[
{
"identity":"SosState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"sosAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"1012",
"config":[
{
"identity":"SosState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"sosAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"1015",
"config":[
{
"identity":"GasSensorState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"gasAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"1008",
"config":[
{
"identity":"SosState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"sosAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"1023",
"config":[
{
"identity":"ContactState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"contactAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"1024",
"config":[
{
"identity":"WaterSensorState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"waterAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"1035",
"config":[
{
"identity":"MotionAlarmState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"motionAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"135",
"config":[
{
"identity":"ContactState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"contactAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"140",
"config":[
{
"identity":"SmokeSensorState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"smokeAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"141",
"config":[
{
"identity":"GasSensorState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"gasAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"26",
"config":[
{
"identity":"MotionAlarmState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"motionAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
{
"productCode":"27",
"config":[
{
"identity":"SmokeSensorState",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"kk_tsl_report_iasZoneStatus",
"controlFunc":""
},{
"identity":"Battery",
"endpoint":1,
"cluster":"0x0001",
"attribute":"0x0021",
"iasStatusMask":"0x0008",
"reportFunc":"kk_tsl_report_battery",
"controlFunc":""
},{
"identity":"smokeAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0001",
"reportFunc":"",
"controlFunc":""
},{
"identity":"batteryAlarm",
"endpoint":1,
"cluster":"0x0500",
"attribute":"0x0002",
"iasStatusMask":"0x0008",
"reportFunc":"",
"controlFunc":""
}
]
}
\ No newline at end of file
......@@ -154,7 +154,7 @@
"productName": "KIT系列.白色温湿度传感器"
},{
"modleId": "0402000D",
"productCode": "3049",
"productCode": "1035",
"productName": "KIT系列.白色人体传感器"
},{
"modleId": "04020015",
......
......@@ -156,6 +156,9 @@ void emberAfPluginDeviceTableDeviceLeftCallback(EmberEUI64 nodeEui64)
rpc_printfJSON("left",nodeJson);
kk_msg_report_dev_leave(deviceTable[deviceTableIndex].eui64);
kk_device_table_delete(deviceTable[deviceTableIndex].eui64);
kk_device_db_delete(deviceTable[deviceTableIndex].eui64);
}
......@@ -331,20 +334,24 @@ void kk_load_dev_map_table(void)
{
int len;
int bufferSize;
int fd = open(KK_DEVICE_MAP_TABLE_FILE,O_RDONLY);
if(fd<0){
UTIL_LOG_ERR("can not open %s,fd=%d!!!\n",KK_DEVICE_MAP_TABLE_FILE,fd);
return ;
}
struct stat statbuff;
stat(KK_DEVICE_MAP_TABLE_FILE, &statbuff);
bufferSize = statbuff.st_size + 128;
uint8_t *buffer = (uint8_t *)malloc(bufferSize);
memset(buffer,0,bufferSize);
;
UTIL_LOG_INFO("\n***************load device map table***************\n");
if(fd<0){
free(buffer);
UTIL_LOG_ERR("can not open %s,fd=%d!!!\n",KK_DEVICE_MAP_TABLE_FILE,fd);
return ;
}
len = read(fd,buffer ,bufferSize);
if(len<0){
free(buffer);
......@@ -524,7 +531,7 @@ bool kk_device_config_exist_check(const char *productCode)
return false;
}
bool kk_device_config_add(const char *productCode,const char *identity,uint8_t ep,uint16_t clu,uint16_t attr,const char *reportFuncName,const char *controlFuncName)
bool kk_device_config_add(const char *productCode,const char *identity,uint8_t ep,uint16_t clu,uint16_t attr,uint16_t mask,const char *reportFuncName,const char *controlFuncName)
{
int len;
kk_dev_config_map *ptr,*pre,*pTemp;
......@@ -552,6 +559,7 @@ bool kk_device_config_add(const char *productCode,const char *identity,uint8_t e
ptr->item.endpoint = ep;
ptr->item.cluster = clu;
ptr->item.attribute = attr;
ptr->item.iasZoneStatusMask = mask;
len = strlen(reportFuncName);
ptr->item.reportFuncName = (char *)malloc(len+1);
......@@ -601,6 +609,7 @@ bool kk_device_config_add(const char *productCode,const char *identity,uint8_t e
newItem->endpoint = ep;
newItem->cluster = clu;
newItem->attribute = attr;
newItem->iasZoneStatusMask = mask;
len = strlen(reportFuncName);
newItem->reportFuncName = (char *)malloc(len+1);
......@@ -705,13 +714,15 @@ kk_dev_config_item_extra_data * kk_find_extra_data(EmberNodeId node,const char *
}
void kk_add_dev_config_map_table_to_list(cJSON * root,const char *productCode)
{
uint8_t ep;
uint16_t clu;
uint16_t attr;
uint8_t ep = 0;
uint16_t clu = 0;
uint16_t attr = 0;
uint16_t mask = 0;
int i,j,len,size,extraSize;
cJSON *item,*identity;
cJSON *endpoint,*cluster,*attribute,*reportFuncName,*controlFuncName;
cJSON *extraRoot,*extraData,*extraDataItem;
cJSON *iasZoneStatusMask;
cJSON * table = rpc_cJSON_GetObjectItem(root,KK_DEVICE_CONFIG_MAP_TABLE_ARRAY_IDENTIFY);
kk_dev_config_item_extra_data *pData = NULL,*ptr = NULL;
......@@ -730,7 +741,7 @@ void kk_add_dev_config_map_table_to_list(cJSON * root,const char *productCode)
attribute = cJSON_GetObjectItem(item, "attribute");
reportFuncName = cJSON_GetObjectItem(item, "reportFunc");
controlFuncName = cJSON_GetObjectItem(item, "controlFunc");
iasZoneStatusMask = cJSON_GetObjectItem(item, "iasStatusMask");
extraRoot = cJSON_GetObjectItem(item, KK_DEVICE_CONFIG_MAP_TABLE_EXTRA_DATA_IDENTIFY);
if(extraRoot!=NULL){
extraSize = rpc_cJSON_GetArraySize(extraRoot);
......@@ -771,20 +782,30 @@ void kk_add_dev_config_map_table_to_list(cJSON * root,const char *productCode)
ep = endpoint->valueint;
len = strlen(cluster->valuestring);
if(len >=4){
clu = rpc_get_u16(&cluster->valuestring[len-4]);
}else{
continue ;
if(cluster!=NULL){
len = strlen(cluster->valuestring);
if(len >=4){
clu = rpc_get_u16(&cluster->valuestring[len-4]);
}else{
continue ;
}
}
len = strlen(attribute->valuestring);
if(len >=4){
attr = rpc_get_u16(&attribute->valuestring[len-4]);
}else{
continue ;
if(attribute!=NULL){
len = strlen(attribute->valuestring);
if(len >=4){
attr = rpc_get_u16(&attribute->valuestring[len-4]);
}else{
continue ;
}
}
kk_device_config_add(productCode,identity->valuestring,ep,clu,attr,reportFuncName->valuestring,controlFuncName->valuestring);
if(clu==ZCL_IAS_ZONE_CLUSTER_ID && attr== ZCL_ZONE_STATUS_ATTRIBUTE_ID){
if(iasZoneStatusMask!=NULL){
len = strlen(iasZoneStatusMask->valuestring);
mask = rpc_get_u16(&iasZoneStatusMask->valuestring[len-4]);
}
}
kk_device_config_add(productCode,identity->valuestring,ep,clu,attr,mask,reportFuncName->valuestring,controlFuncName->valuestring);
kk_append_extra_data_to_list(productCode,pData);
......@@ -878,6 +899,7 @@ void kk_device_config_map_print(void)
emberAfCorePrintln("endpoint:%d\n",item->endpoint);
emberAfCorePrintln("cluster:0x%04X\n",item->cluster);
emberAfCorePrintln("attribute:0x%04X\n",item->attribute);
emberAfCorePrintln("iasZoneStatusMask:0x%04X\n",item->iasZoneStatusMask);
emberAfCorePrintln("reportFunc:%s\n",item->reportFuncName);
emberAfCorePrintln("controlFunc:%s\n",item->controlFuncName);
extra = item->data;
......
......@@ -14,7 +14,7 @@
#define KK_MAX_READ_MODLE_ID_COUNT 30
#define KK_NETWORK_PARAMETER_TX_POWER 10
#define KK_NETWORK_PARAMETER_CHANNEL 0x0B
#define KK_NETWORK_PARAMETER_CHANNEL 15
#define KK_EP(x) (x)
#define KK_DUMMY_EP KK_EP(0)
......@@ -61,6 +61,7 @@ typedef struct kk_dev_config_item{
kk_rpc_set * controlFunc;
uint8_t endpoint;
uint16_t cluster;
uint16_t iasZoneStatusMask;
uint16_t attribute;
kk_dev_config_item_extra_data *data;
struct kk_dev_config_item * next;
......
......@@ -52,7 +52,6 @@ void kk_print_device_table(void)
ptr = ptr->next;
}
}
static kk_device_table_s *kk_device_table_create()
{
......@@ -532,6 +531,7 @@ void emberAfPluginDeviceTableInitialized(void)
{
kk_device_db_load();
kk_print_device_table();
kk_load_dev_map_table();
kk_device_map_print();
kk_device_config_load_from_db();
......
......@@ -64,6 +64,12 @@ void kk_msg_report_property(cJSON *data,EmberEUI64 mac)
{
kk_msg_report(data,KK_REPORT_ATTRIBUTE_TYPE,KK_REPORT_ATTRIBUTE_METHOD,mac);
}
void kk_msg_report_alarm(cJSON *data,EmberEUI64 mac)
{
kk_msg_report(data,KK_REPORT_ALARM_TYPE,KK_REPORT_ALARM_METHOD,mac);
}
void kk_msg_report_dev_joined(EmberEUI64 mac,const char* productCode)
{
......
......@@ -15,6 +15,11 @@
#define KK_REPORT_DEVICE_LEAVE_METHOD "thing.topo.delete"
#define KK_REPORT_DEVICE_BATCH_LEAVE_METHOD "thing.topo.batchDelete"
#define KK_REPORT_ALARM_METHOD "thing.event.alarm.post"
#define KK_REPORT_ATTRIBUTE_METHOD "thing.event.property.post"
#define KK_READ_ATTRIBUTE_METHOD "thing.service.property.get"
......@@ -23,6 +28,7 @@
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_DEVICE_BATCH_LEFT_TYPE "/thing/topo/batch_delete"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
#define KK_REPORT_ALARM_TYPE "/thing/event/alarm/post"
#define GW2CCU_PROTOCOL "tcp"
......@@ -35,6 +41,7 @@ int kk_sendData2CCU(char* data, int len);
void kk_msg_report_dev_leave(EmberEUI64 mac);
void kk_msg_report_dev_joined(EmberEUI64 mac,const char* productCode);
void kk_msg_report_property(cJSON *data,EmberEUI64 mac);
void kk_msg_report_alarm(cJSON *data,EmberEUI64 mac);
......
......@@ -75,32 +75,102 @@ static int kk_tsl_report(EmberEUI64 mac,uint8_t EP,int status,uint16_t clusterId
if(dev_info == NULL){
return tsl_rpt_err;
}
item = &dev_info->item;
while(item!=NULL){
if(EP == item->endpoint &&
clusterId == item->cluster&&
attributeId == item->attribute){
Identify = item->identity;
break;
if(clusterId==ZCL_IAS_ZONE_CLUSTER_ID && attributeId== ZCL_ZONE_STATUS_ATTRIBUTE_ID){
while(item!=NULL){
if(EP == item->endpoint &&
clusterId == item->cluster&&
attributeId == item->attribute){
{
if(item->iasZoneStatusMask!=0){
root_tmp = kk_check_identify(Identify,root,index,status);
if(root_tmp != NULL){
kk_rpc_report_status(root_tmp,mac);
}
else{
status = ((status&0xffff)&item->iasZoneStatusMask) ? 1 : 0;
rpc_cJSON_AddNumberToObject(root, Identify,status);
kk_msg_report_property(root,mac);
}
}
}
}
item = item->next;
}
}else{
while(item!=NULL){
if(EP == item->endpoint &&
clusterId == item->cluster&&
attributeId == item->attribute){
Identify = item->identity;
break;
}
item = item->next;
}
root_tmp = kk_check_identify(Identify,root,index,status);
if(root_tmp != NULL){
kk_rpc_report_status(root_tmp,mac);
}
else{
if(clusterId==ZCL_BASIC_CLUSTER_ID && attributeId== ZCL_BATTERY_PERCENTAGE_REMAINING_ATTRIBUTE_ID){
double battery = (double)status * 0.5;
char batteryStr[32];
sprintf(batteryStr,"f",battery);
rpc_cJSON_AddStringToObject(root, Identify,batteryStr);
}else{
rpc_cJSON_AddNumberToObject(root, Identify,status);
}
kk_msg_report_property(root,mac);
}
item = item->next;
}
root_tmp = kk_check_identify(Identify,root,index,status);
if(root_tmp != NULL){
kk_rpc_report_status(root_tmp,mac);
}
else{
rpc_cJSON_AddNumberToObject(root, Identify,status);
kk_msg_report_property(root,mac);
}
return tsl_rpt_success;
}
//typedef int(*kk_rpc_report)(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,EmberAfAttributeId attributeId,uint8_t dataType,uint8_t len,uint8_t *data);
void kk_tsl_report_alarm(EmberEUI64 eui64,
uint16_t zoneStatus,
uint8_t extendedStatus,
uint8_t zoneId,
uint16_t delay)
{
cJSON* root;
kk_device_table_s *dev = NULL;
kk_dev_config_map *dev_info = NULL;
kk_dev_config_item *item = NULL;
kk_rpc_report func;
UTIL_LOG_INFO("\n********************kk_tsl_report_alarm********************\n");
dev = kk_device_find_by_mac(eui64);
if(dev == NULL){
printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
return;
}
dev_info = kk_device_config_find(dev->productCode);
if(dev_info == NULL){
printf("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,%s\n",dev->productCode);
return;
}
item = &dev_info->item;
while(item!=NULL){
printf("&&&&&&&&&&&&&&&&&&&&&&\n");
if(item->cluster== ZCL_IAS_ZONE_CLUSTER_ID
&& item->attribute ==ZCL_ZONE_STATUS_ATTRIBUTE_ID &&
item->iasZoneStatusMask!=0 && item->reportFunc==NULL){
printf("!!!!!!!!!!!!\n");
root = rpc_cJSON_CreateObject();
rpc_cJSON_AddNumberToObject(root, item->identity,(zoneStatus & item->iasZoneStatusMask) ? 1 : 0);
kk_msg_report_alarm(root,eui64);
}
item = item->next;
printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
}
}
void kk_tsl_report_attribute(EmberEUI64 eui64,
uint8_t EP,
......@@ -439,3 +509,51 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
int kk_tsl_report_iasZoneStatus(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,EmberAfAttributeId attributeId,uint8_t dataType,uint8_t len,uint8_t *data)
{
uint16_t value;
kk_device_table_s *dev;
UTIL_LOG_INFO("[tsl report:kk_tsl_report_iasZoneStatus] value:%d\n",value);
dev = kk_device_find_by_mac(eui64);
if(dev == NULL){
return tsl_rpt_err;
}
if(dataType == ZCL_BITMAP16_ATTRIBUTE_TYPE){
if(len==2){
value = KK_GET_U16(data);
kk_tsl_report(eui64,EP,value,clusterId,attributeId);
return tsl_rpt_success;
}
}
return tsl_rpt_err;
}
int kk_tsl_report_battery(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,EmberAfAttributeId attributeId,uint8_t dataType,uint8_t len,uint8_t *data)
{
uint8_t value = data[0];
kk_device_table_s *dev;
UTIL_LOG_INFO("[tsl report:kk_tsl_report_battery] value:%d\n",value);
dev = kk_device_find_by_mac(eui64);
if(dev == NULL){
return tsl_rpt_err;
}
if(dataType == ZCL_INT8U_ATTRIBUTE_TYPE){
if(len==1){
kk_tsl_report(eui64,EP,value,clusterId,attributeId);
return tsl_rpt_success;
}
}
return tsl_rpt_err;
}
......@@ -19,6 +19,11 @@ void kk_tsl_report_attribute(EmberEUI64 eui64,
uint8_t dataType,
uint8_t len,
uint8_t *data);
void kk_tsl_report_alarm(EmberEUI64 eui64,
uint16_t zoneStatus,
uint8_t extendedStatus,
uint8_t zoneId,
uint16_t delay);
int kk_tsl_report_global_onoff(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,EmberAfAttributeId attributeId,uint8_t dataType,uint8_t len,uint8_t *data);
......@@ -45,6 +50,8 @@ int kk_tsl_report_colorControl_RGB(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId
int kk_tsl_report_iasZoneStatus(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,EmberAfAttributeId attributeId,uint8_t dataType,uint8_t len,uint8_t *data);
int kk_tsl_report_battery(EmberEUI64 eui64,uint8_t EP,EmberAfClusterId clusterId,EmberAfAttributeId attributeId,uint8_t dataType,uint8_t len,uint8_t *data);
......
......@@ -34,6 +34,8 @@ void kk_rpc_test(void);
{"kk_tsl_report_global_onoff",kk_tsl_report_global_onoff},\
{"kk_tsl_report_colorControl_Brightness",kk_tsl_report_colorControl_Brightness},\
{"kk_tsl_report_colorControl_RGB",kk_tsl_report_colorControl_RGB},\
{"kk_tsl_report_iasZoneStatus",kk_tsl_report_iasZoneStatus},\
{"kk_tsl_report_battery",kk_tsl_report_battery},\
}
kk_rpc_set_api_s kk_rpc_set_api[];
......
......@@ -2376,9 +2376,9 @@ static EmberCommandEntry emberCommandTablePluginOtaStorageCommonCommands[] = {
emberCommandEntryActionWithDetails("data-print", emAfOtaStorageDataPrint, "uw", "Print arbitray bytes of the OTA image on disk.", emberCommandTablePluginOtaStorageCommonDataPrintCommandArguments),
emberCommandEntryActionWithDetails("delete", emAfOtaImageDelete, "u", "Deletes the image at the specified index.", emberCommandTablePluginOtaStorageCommonDeleteCommandArguments),
emberCommandEntryActionWithDetails("printImages", emAfOtaPrintAllImages, "", "Prints the images.", NULL),
emberCommandEntryActionWithDetails("reload", emAfOtaReloadStorageDevice, "", "Reload the storage device.", NULL),
emberCommandEntryActionWithDetails("storage-info", emAfOtaStorageInfoPrint, "", "Print information about the storage device.", NULL),
emberCommandEntryTerminator()
emberCommandEntryActionWithDetails("reload", emAfOtaReloadStorageDevice, "", "Reload the storage device.", NULL),
emberCommandEntryActionWithDetails("storage-info", emAfOtaStorageInfoPrint, "", "Print information about the storage device.", NULL),
emberCommandEntryTerminator()
};
#if defined(EMBER_COMMAND_INTEPRETER_HAS_DESCRIPTION_FIELD)
......
......@@ -1989,7 +1989,7 @@ typedef enum {
EMBER_ZCL_STATUS_ABORT = 0x95,
EMBER_ZCL_STATUS_INVALID_IMAGE = 0x96,
EMBER_ZCL_STATUS_WAIT_FOR_DATA = 0x97,
EMBER_ZCL_STATUS_NO_IMAGE_AVAILABLE = 0x98,
EMBER_ZCL_STATUS_NO_IMAGE_AVAILABLE = 0x98,
EMBER_ZCL_STATUS_REQUIRE_MORE_IMAGE = 0x99,
EMBER_ZCL_STATUS_HARDWARE_FAILURE = 0xC0,
EMBER_ZCL_STATUS_SOFTWARE_FAILURE = 0xC1,
......
......@@ -266,7 +266,7 @@ int _init_param(struct jrpc_server *server) {
//kk_zlog_init("paltform");
printf("getenv\r\n");
char * debug_level_env = getenv("HOME");
char * debug_level_env = getenv("JRPC_DEBUG");
printf("getenv(JRPC_DEBUG):%s\n", server->debug_level);
if (debug_level_env == NULL)
server->debug_level = 0;
......
......@@ -89,6 +89,8 @@ void kk_read_ncp_configuration_without_memory_allocation(void)
extern void kk_print_network_info(void);
extern void test_123(int val);
extern void kk_ota_test111();
extern void kk_ota_test123123123();
void kk_message_process(char *messageString)
{
......@@ -111,30 +113,10 @@ void kk_message_process(char *messageString)
}
if(MEMCOMPARE(messageString,"AT+TEST1\r\n",len)==0){
uint16_t h;
unsigned char s,l;
RGB_to_HSL(100, 150, 200,&h,&s,&l);
emberAfAppPrintln("%d,%d,%d",h,s,l);
emberAfAppPrintln("%d,%d,%d",h*254/360,s*254/100,l);
kk_device_table_s* dev = kk_device_find_by_node(0x5996);
dev->manage.dev.ColorLighting.color.HSL.L = l;
zclLevel_MoveToLevel(0x5996,1,l,0,NULL,NULL);
zclColorControlMovetohueandsat(0x5996,1,h*254/360,s*254/100,0,0,0,0);
emberAfAppPrint("AT+TEST1\r\n" );
kk_ota_test123123123();
}
if(MEMCOMPARE(messageString,"AT+TEST2\r\n",len)==0){
uint16_t h;
unsigned char s,l;
RGB_to_HSL(20, 24, 22,&h,&s,&l);
emberAfAppPrintln("%d,%d,%d",h,s,l);
emberAfAppPrintln("%d,%d,%d",h*254/360,s*254/100,l);
kk_device_table_s* dev = kk_device_find_by_node(0x5996);
dev->manage.dev.ColorLighting.color.HSL.L = l;
zclLevel_MoveToLevel(0x5996,1,l,0,NULL,NULL);
zclColorControlMovetohueandsat(0x5996,1,h*254/360,s*254/100,0,0,0,0);
emberAfAppPrint("AT+TEST2\r\n" );
if(MEMCOMPARE(messageString,"AT+TEST\r\n",len)==0){
kk_ota_test111();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -47,13 +47,13 @@ void halReboot(void)
uint8_t halGetResetInfo(void)
{
return RESET_SOFTWARE;
return RESET_SOFTWARE;
}
PGM_P halGetResetString(void)
{
static PGM_P resetString = "SOFTWARE";
return (resetString);
static PGM_P resetString = "SOFTWARE";
return (resetString);
}
// Ideally this should not be necessary, but the serial code references
......
......@@ -31,31 +31,31 @@ void ashPrintCounters(AshCount *counters, bool clear);
void ashClearCounters(AshCount *counters);
static const char usage[] =
" {ncp type} {options}\n"
" ncp type:\n"
" -n 0,1 0=EM2xx/EM3xx @ 115200 bps, RTS/CTS\n"
" 1=EM2xx/EM3xx @ 57600 bps, XON/XOFF\n"
" (if present must be the first option)\n"
" options:\n"
" -b <baud rate> 9600, 19200, 38400, 57600, 115200, etc.\n"
" -f r,x flow control: r=RST/CTS, x=XON/XOFF\n"
" -h display usage information\n"
" -i 0,1 enable/disable input buffering\n"
" -o 0,1 enable/disable output buffering\n"
" -p <port> serial port name or number (eg, COM1, ttyS0, or 1)\n"
" -r d,r,c ncp reset method: d=DTR, r=RST frame, c=custom\n"
" -s 1,2 stop bits\n"
" -t <trace flags> trace B0=frames, B1=verbose frames, B2=events, B3=EZSP\n"
" -v[base-port] enables virtual ISA support. The [base-port] argument\n"
" is optional. Both serial ports are available via telnet\n"
" instead of local console. RAW serial port is available\n"
" on the first port (offset 0 from base port), and CLI is\n"
" available on the second port (offset 1 from base port).\n"
" By default, 4900 is the base-port, therefore RAW access\n"
" is available from port 4900, and CLI access is available\n"
" on port 4901.\n"
" NOTE: No space is allowed between '-v' and [base-port].\n"
" -x 0,1 enable/disable data randomization\n";
" {ncp type} {options}\n"
" ncp type:\n"
" -n 0,1 0=EM2xx/EM3xx @ 115200 bps, RTS/CTS\n"
" 1=EM2xx/EM3xx @ 57600 bps, XON/XOFF\n"
" (if present must be the first option)\n"
" options:\n"
" -b <baud rate> 9600, 19200, 38400, 57600, 115200, etc.\n"
" -f r,x flow control: r=RST/CTS, x=XON/XOFF\n"
" -h display usage information\n"
" -i 0,1 enable/disable input buffering\n"
" -o 0,1 enable/disable output buffering\n"
" -p <port> serial port name or number (eg, COM1, ttyS0, or 1)\n"
" -r d,r,c ncp reset method: d=DTR, r=RST frame, c=custom\n"
" -s 1,2 stop bits\n"
" -t <trace flags> trace B0=frames, B1=verbose frames, B2=events, B3=EZSP\n"
" -v[base-port] enables virtual ISA support. The [base-port] argument\n"
" is optional. Both serial ports are available via telnet\n"
" instead of local console. RAW serial port is available\n"
" on the first port (offset 0 from base port), and CLI is\n"
" available on the second port (offset 1 from base port).\n"
" By default, 4900 is the base-port, therefore RAW access\n"
" is available from port 4900, and CLI access is available\n"
" on port 4901.\n"
" NOTE: No space is allowed between '-v' and [base-port].\n"
" -x 0,1 enable/disable data randomization\n";
static const AshCount zeroAshCount = { 0 };
......
......@@ -559,6 +559,7 @@ bool ezspSerialPortRegisterCallback(EzspSerialPortCallbackFunction callback)
void ezspSerialWriteByte(uint8_t byte)
{
BUMP_HOST_COUNTER(txBytes);
#ifdef IO_LOG
{
......
......@@ -66,10 +66,10 @@
void ezspPrintUsage(char *name)
{
char *shortName = strrchr(name, '/');
shortName = shortName ? shortName + 1 : name;
fprintf(stderr, "Usage: %s", shortName);
fprintf(stderr, usage);
char *shortName = strrchr(name, '/');
shortName = shortName ? shortName + 1 : name;
fprintf(stderr, "Usage: %s", shortName);
fprintf(stderr, usage);
}
#ifdef __CYGWIN__
......@@ -103,16 +103,16 @@ bool checkSerialPort(const char* portString, bool silent)
bool ezspProcessCommandOptions(int argc, char *argv[])
{
char errStr[ERR_LEN] = "";
if (!ezspInternalProcessCommandOptions(argc, argv, errStr)) {
return false;
}
if (*errStr != '\0') {
fprintf(stderr, "%s", errStr);
ezspPrintUsage(argv[0]);
}
return (*errStr == '\0');
char errStr[ERR_LEN] = "";
if (!ezspInternalProcessCommandOptions(argc, argv, errStr)) {
return false;
}
if (*errStr != '\0') {
fprintf(stderr, "%s", errStr);
ezspPrintUsage(argv[0]);
}
return (*errStr == '\0');
}
//------------------------------------------------------------------------------
......
......@@ -1122,26 +1122,26 @@ typedef struct {
* an upgrade file.
*/
typedef struct {
uint16_t manufacturerId;
uint16_t imageTypeId;
uint32_t firmwareVersion;
uint16_t manufacturerId;
uint16_t imageTypeId;
uint32_t firmwareVersion;
/**
* This is only used for device specific files.
* It will be set to all 0's when the image does not
* have an upgrade destination field in it.
* Little endian format.
*/
uint8_t deviceSpecificFileEui64[EUI64_SIZE];
/**
* This is only used for device specific files.
* It will be set to all 0's when the image does not
* have an upgrade destination field in it.
* Little endian format.
*/
uint8_t deviceSpecificFileEui64[EUI64_SIZE];
} EmberAfOtaImageId;
/**
* @brief The list of options possible for the image block request/response.
*/
enum {
EMBER_AF_IMAGE_BLOCK_REQUEST_OPTIONS_NONE = 0,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_CLIENT = 1,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_SERVER = 2,
EMBER_AF_IMAGE_BLOCK_REQUEST_OPTIONS_NONE = 0,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_CLIENT = 1,
EMBER_AF_IMAGE_BLOCK_REQUEST_MIN_BLOCK_REQUEST_SUPPORTED_BY_SERVER = 2,
};
typedef uint8_t EmberAfImageBlockRequestOptions;
......@@ -1150,18 +1150,18 @@ typedef uint8_t EmberAfImageBlockRequestOptions;
* emberAfImageBlockRequestCallback() to let the application decide what to do.
*/
typedef struct {
const EmberAfOtaImageId* id;
uint32_t offset;
const EmberAfOtaImageId* id;
uint32_t offset;
uint32_t waitTimeSecondsResponse;
EmberNodeId source;
EmberEUI64 sourceEui; // optionally present in messages
// The minBlockRequestPeriod can be treated as milliseconds or seconds on the
// client. The OTA server plugin has optional support to probe clients and
// treat this field with appropriate units (ms or sec)
uint16_t minBlockRequestPeriod; // optionally present in messages
uint8_t maxDataSize;
uint8_t clientEndpoint;
EmberAfImageBlockRequestOptions bitmask;
EmberNodeId source;
EmberEUI64 sourceEui; // optionally present in messages
// The minBlockRequestPeriod can be treated as milliseconds or seconds on the
// client. The OTA server plugin has optional support to probe clients and
// treat this field with appropriate units (ms or sec)
uint16_t minBlockRequestPeriod; // optionally present in messages
uint8_t maxDataSize;
uint8_t clientEndpoint;
EmberAfImageBlockRequestOptions bitmask;
} EmberAfImageBlockRequestCallbackStruct;
/**
......@@ -1169,11 +1169,11 @@ typedef struct {
* device operation.
*/
typedef enum {
EMBER_AF_OTA_STORAGE_SUCCESS = 0,
EMBER_AF_OTA_STORAGE_ERROR = 1,
EMBER_AF_OTA_STORAGE_RETURN_DATA_TOO_LONG = 2,
EMBER_AF_OTA_STORAGE_PARTIAL_FILE_FOUND = 3,
EMBER_AF_OTA_STORAGE_OPERATION_IN_PROGRESS = 4,
EMBER_AF_OTA_STORAGE_SUCCESS = 0,
EMBER_AF_OTA_STORAGE_ERROR = 1,
EMBER_AF_OTA_STORAGE_RETURN_DATA_TOO_LONG = 2,
EMBER_AF_OTA_STORAGE_PARTIAL_FILE_FOUND = 3,
EMBER_AF_OTA_STORAGE_OPERATION_IN_PROGRESS = 4,
} EmberAfOtaStorageStatus;
/**
......@@ -1203,41 +1203,41 @@ typedef uint8_t EmberAfOtaDownloadResult;
* It is not a byte-for-byte copy.
*/
typedef struct {
// Magic Number omitted since it is always the same.
uint16_t headerVersion;
uint16_t headerLength;
uint16_t fieldControl;
uint16_t manufacturerId;
uint16_t imageTypeId; // a.k.a. Device ID
uint32_t firmwareVersion;
uint16_t zigbeeStackVersion;
// Magic Number omitted since it is always the same.
uint16_t headerVersion;
uint16_t headerLength;
uint16_t fieldControl;
uint16_t manufacturerId;
uint16_t imageTypeId; // a.k.a. Device ID
uint32_t firmwareVersion;
uint16_t zigbeeStackVersion;
/**
* @brief The spec. does NOT require that the string be NULL terminated in the
* header stored on disk. Therefore we make sure we can support a
* 32-character string without a NULL terminator by adding +1 in the data
* structure.
*/
uint8_t headerString[EMBER_AF_OTA_MAX_HEADER_STRING_LENGTH + 1];
/**
* @brief The spec. does NOT require that the string be NULL terminated in the
* header stored on disk. Therefore we make sure we can support a
* 32-character string without a NULL terminator by adding +1 in the data
* structure.
*/
uint8_t headerString[EMBER_AF_OTA_MAX_HEADER_STRING_LENGTH + 1];
/**
* @brief When reading the header this will be the complete length of
* the file. When writing the header, this must be set to
* the length of the MFG image data portion including all tags.
*/
uint32_t imageSize;
/**
* @brief When reading the header this will be the complete length of
* the file. When writing the header, this must be set to
* the length of the MFG image data portion including all tags.
*/
uint32_t imageSize;
/**
* @brief The remaining four fields are optional. The field control should be checked
* to determine if their values are valid.
*/
uint8_t securityCredentials;
union {
uint8_t EUI64[EUI64_SIZE];
uint8_t UID[UID_SIZE];
} upgradeFileDestination;
uint16_t minimumHardwareVersion;
uint16_t maximumHardwareVersion;
/**
* @brief The remaining four fields are optional. The field control should be checked
* to determine if their values are valid.
*/
uint8_t securityCredentials;
union {
uint8_t EUI64[EUI64_SIZE];
uint8_t UID[UID_SIZE];
} upgradeFileDestination;
uint16_t minimumHardwareVersion;
uint16_t maximumHardwareVersion;
} EmberAfOtaHeader;
/**
......
......@@ -89,94 +89,94 @@ static int myVprintf(int fd, const char* formatString, va_list ap);
EmberStatus backchannelStartServer(uint8_t port)
{
struct sockaddr_in serverAddress;
int flags;
if (!backchannelEnable) {
return EMBER_INVALID_CALL;
}
if (port > 1) {
return EMBER_SERIAL_INVALID_PORT;
}
if (socketFd[port] != -1) {
return EMBER_INVALID_CALL;
}
socketFd[port] = socket(AF_INET, SOCK_STREAM, 0);
if (socketFd[port] < 0) {
unixError("Error: Could not open socket");
return EMBER_ERR_FATAL;
}
flags = 1; // Enable SO_REUSEADDR to reduce bind() complaints
struct sockaddr_in serverAddress;
int flags;
if (!backchannelEnable) {
return EMBER_INVALID_CALL;
}
if (port > 1) {
return EMBER_SERIAL_INVALID_PORT;
}
if (socketFd[port] != -1) {
return EMBER_INVALID_CALL;
}
socketFd[port] = socket(AF_INET, SOCK_STREAM, 0);
if (socketFd[port] < 0) {
unixError("Error: Could not open socket");
return EMBER_ERR_FATAL;
}
flags = 1; // Enable SO_REUSEADDR to reduce bind() complaints
(void) setsockopt(socketFd[port], SOL_SOCKET, SO_REUSEADDR, &flags,
sizeof(flags));
bzero(&(clientConnections[port]), sizeof(struct sockaddr_in));
bzero((char *) &serverAddress, sizeof(serverAddress));
serverAddress.sin_family = AF_INET;
serverAddress.sin_addr.s_addr = INADDR_ANY;
serverAddress.sin_port = htons(SERVER_PORT_OFFSET + port);
if (bind(socketFd[port],
(struct sockaddr *) &serverAddress,
sizeof(serverAddress)) < 0) {
unixError("Error: Could not bind socket to %u", SERVER_PORT_OFFSET + port);
return EMBER_ERR_FATAL;
}
if (0 > listen(socketFd[port], 0)) {
unixError("Error: Could not mark socket as listening");
return EMBER_ERR_FATAL;
}
infoPrint("Listening for connections on port %u", SERVER_PORT_OFFSET + port);
return EMBER_SUCCESS;
bzero(&(clientConnections[port]), sizeof(struct sockaddr_in));
bzero((char *) &serverAddress, sizeof(serverAddress));
serverAddress.sin_family = AF_INET;
serverAddress.sin_addr.s_addr = INADDR_ANY;
serverAddress.sin_port = htons(SERVER_PORT_OFFSET + port);
if (bind(socketFd[port],
(struct sockaddr *) &serverAddress,
sizeof(serverAddress)) < 0) {
unixError("Error: Could not bind socket to %u", SERVER_PORT_OFFSET + port);
return EMBER_ERR_FATAL;
}
if (0 > listen(socketFd[port], 0)) {
unixError("Error: Could not mark socket as listening");
return EMBER_ERR_FATAL;
}
infoPrint("Listening for connections on port %u", SERVER_PORT_OFFSET + port);
return EMBER_SUCCESS;
}
EmberStatus backchannelClientConnectionCleanup(uint8_t port)
{
if (!backchannelEnable) {
return EMBER_INVALID_CALL;
}
if (port > 1) {
return EMBER_SERIAL_INVALID_PORT;
}
if (clientFd[port] != INVALID_FD) {
myPrintf(REMOTE_STDOUT,
"Server closing client connection from %s:%u on port %u\n",
inet_ntoa(clientConnections[port].sin_addr),
ntohs(clientConnections[port].sin_port),
SERVER_PORT_OFFSET + port);
infoPrint("Server closing client connection from %s:%u on port %u\n",
inet_ntoa(clientConnections[port].sin_addr),
ntohs(clientConnections[port].sin_port),
SERVER_PORT_OFFSET + port);
close(clientFd[port]);
clientFd[port] = INVALID_FD;
bzero(&(clientConnections[port]), sizeof(struct sockaddr_in));
}
return EMBER_SUCCESS;
if (!backchannelEnable) {
return EMBER_INVALID_CALL;
}
if (port > 1) {
return EMBER_SERIAL_INVALID_PORT;
}
if (clientFd[port] != INVALID_FD) {
myPrintf(REMOTE_STDOUT,
"Server closing client connection from %s:%u on port %u\n",
inet_ntoa(clientConnections[port].sin_addr),
ntohs(clientConnections[port].sin_port),
SERVER_PORT_OFFSET + port);
infoPrint("Server closing client connection from %s:%u on port %u\n",
inet_ntoa(clientConnections[port].sin_addr),
ntohs(clientConnections[port].sin_port),
SERVER_PORT_OFFSET + port);
close(clientFd[port]);
clientFd[port] = INVALID_FD;
bzero(&(clientConnections[port]), sizeof(struct sockaddr_in));
}
return EMBER_SUCCESS;
}
EmberStatus backchannelStopServer(uint8_t port)
{
if (!backchannelEnable) {
return EMBER_INVALID_CALL;
}
if (port > 1) {
return EMBER_SERIAL_INVALID_PORT;
}
backchannelClientConnectionCleanup(port);
if (socketFd[port] != INVALID_FD) {
myPrintf(LOCAL_STDOUT, "Server closing socket connection %u\n",
SERVER_PORT_OFFSET + port);
close(socketFd[port]);
socketFd[port] = INVALID_FD;
}
return EMBER_SUCCESS;
if (!backchannelEnable) {
return EMBER_INVALID_CALL;
}
if (port > 1) {
return EMBER_SERIAL_INVALID_PORT;
}
backchannelClientConnectionCleanup(port);
if (socketFd[port] != INVALID_FD) {
myPrintf(LOCAL_STDOUT, "Server closing socket connection %u\n",
SERVER_PORT_OFFSET + port);
close(socketFd[port]);
socketFd[port] = INVALID_FD;
}
return EMBER_SUCCESS;
}
// Retrieves a single byte from the client connection. Returns the number
......@@ -226,23 +226,23 @@ EmberStatus backchannelSend(uint8_t port, uint8_t * data, uint8_t length)
// If one doesn't exist, it can wait for a new connection and return
// the result.
BackchannelState backchannelCheckConnection(uint8_t port,
bool waitForConnection)
bool waitForConnection)
{
if (!backchannelEnable) {
return CONNECTION_ERROR;
} else if (clientFd[port] >= 0) {
return CONNECTION_EXISTS;
}
bool getConnection = false;
if (waitForConnection) {
infoPrint("Waiting for client connection on port %u",
port + SERVER_PORT_OFFSET);
getConnection = true;
} else if (!willServerConnectionBlock(port)) {
getConnection = true;
}
if (!backchannelEnable) {
return CONNECTION_ERROR;
} else if (clientFd[port] >= 0) {
return CONNECTION_EXISTS;
}
bool getConnection = false;
if (waitForConnection) {
infoPrint("Waiting for client connection on port %u",
port + SERVER_PORT_OFFSET);
getConnection = true;
} else if (!willServerConnectionBlock(port)) {
getConnection = true;
}
if (getConnection) {
return (getNewConnection(port)
......@@ -450,32 +450,32 @@ static bool getNewConnection(uint8_t port)
// Print an error message plus the associated 'errno' string
static void unixError(const char* format, ...)
{
va_list ap = { 0 };
va_start(ap, format);
myVprintf(LOCAL_STDERR, format, ap);
va_end(ap);
myPrintf(LOCAL_STDERR, ": %s\n", strerror(errno));
va_list ap = { 0 };
va_start(ap, format);
myVprintf(LOCAL_STDERR, format, ap);
va_end(ap);
myPrintf(LOCAL_STDERR, ": %s\n", strerror(errno));
}
static void debugPrint(const char* formatString, ...)
{
if (debugOn) {
va_list ap = { 0 };
myPrintf(LOCAL_STDERR, "[%s] ", debugString);
va_start(ap, formatString);
myVprintf(LOCAL_STDERR, formatString, ap);
va_end(ap);
myPrintf(LOCAL_STDERR, "\n");
}
if (debugOn) {
va_list ap = { 0 };
myPrintf(LOCAL_STDERR, "[%s] ", debugString);
va_start(ap, formatString);
myVprintf(LOCAL_STDERR, formatString, ap);
va_end(ap);
myPrintf(LOCAL_STDERR, "\n");
}
}
static void infoPrint(const char* formatString, ...)
{
va_list ap = { 0 };
va_start(ap, formatString);
myVprintf(LOCAL_STDOUT, formatString, ap);
va_end(ap);
myPrintf(LOCAL_STDOUT, "\n");
va_list ap = { 0 };
va_start(ap, formatString);
myVprintf(LOCAL_STDOUT, formatString, ap);
va_end(ap);
myPrintf(LOCAL_STDOUT, "\n");
}
// Because we mess around with FDs, we need our own printing routine
......@@ -483,20 +483,20 @@ static void infoPrint(const char* formatString, ...)
static int myPrintf(int fd, const char* formatString, ...)
{
va_list ap = { 0 };
int returnCode;
va_start(ap, formatString);
returnCode = myVprintf(fd, formatString, ap);
va_end(ap);
return returnCode;
va_list ap = { 0 };
int returnCode;
va_start(ap, formatString);
returnCode = myVprintf(fd, formatString, ap);
va_end(ap);
return returnCode;
}
// Returns 0 on success, 1 on error
static int myVprintf(int fd, const char* formatString, va_list ap)
{
int length;
char string[MAX_STRING_LENGTH];
length = vsnprintf(string, MAX_STRING_LENGTH - 1, formatString, ap);
string[length] = '\0';
return (length != write(fd, string, length));
int length;
char string[MAX_STRING_LENGTH];
length = vsnprintf(string, MAX_STRING_LENGTH - 1, formatString, ap);
string[length] = '\0';
return (length != write(fd, string, length));
}
......@@ -65,28 +65,28 @@ static void ezspSerialPortCallback(EzspSerialPortEvent event, int fileDescriptor
static EmberStatus gatewayBackchannelStart(void)
{
if (backchannelEnable) {
if (EMBER_SUCCESS != backchannelStartServer(SERIAL_PORT_CLI)) {
fprintf(stderr,
"Fatal: Failed to start backchannel services for CLI.\n");
return EMBER_ERR_FATAL;
}
if (EMBER_SUCCESS != backchannelStartServer(SERIAL_PORT_RAW)) {
fprintf(stderr,
"Fatal: Failed to start backchannel services for RAW data.\n");
return EMBER_ERR_FATAL;
}
}
return EMBER_SUCCESS;
if (backchannelEnable) {
if (EMBER_SUCCESS != backchannelStartServer(SERIAL_PORT_CLI)) {
fprintf(stderr,
"Fatal: Failed to start backchannel services for CLI.\n");
return EMBER_ERR_FATAL;
}
if (EMBER_SUCCESS != backchannelStartServer(SERIAL_PORT_RAW)) {
fprintf(stderr,
"Fatal: Failed to start backchannel services for RAW data.\n");
return EMBER_ERR_FATAL;
}
}
return EMBER_SUCCESS;
}
void gatewayBackchannelStop(void)
{
if (backchannelEnable) {
backchannelStopServer(SERIAL_PORT_CLI);
backchannelStopServer(SERIAL_PORT_RAW);
}
if (backchannelEnable) {
backchannelStopServer(SERIAL_PORT_CLI);
backchannelStopServer(SERIAL_PORT_RAW);
}
}
bool emberAfMainStartCallback(int* returnCode,
......@@ -95,21 +95,21 @@ bool emberAfMainStartCallback(int* returnCode,
{
debugPrint("gatewaitInit()");
// This will process EZSP command-line options as well as determine
// whether the backchannel should be turned on.
if (!ezspProcessCommandOptions(argc, argv)) {
*returnCode = EMBER_ERR_FATAL;
return true;
}
// This will process EZSP command-line options as well as determine
// whether the backchannel should be turned on.
if (!ezspProcessCommandOptions(argc, argv)) {
*returnCode = EMBER_ERR_FATAL;
return true;
}
*returnCode = gatewayBackchannelStart();
if (*returnCode != EMBER_SUCCESS) {
return true;
}
*returnCode = gatewayBackchannelStart();
if (*returnCode != EMBER_SUCCESS) {
return true;
}
emberSerialSetPrompt(cliPrompt);
emberSerialSetPrompt(cliPrompt);
emberSerialCommandCompletionInit(emberCommandTable);
emberSerialCommandCompletionInit(emberCommandTable);
return false;
}
......
......@@ -3,10 +3,10 @@ void gatewayBackchannelStop(void);
typedef uint8_t BackchannelState;
enum {
NO_CONNECTION = 0,
CONNECTION_EXISTS = 1,
NEW_CONNECTION = 2,
CONNECTION_ERROR = 3,
NO_CONNECTION = 0,
CONNECTION_EXISTS = 1,
NEW_CONNECTION = 2,
CONNECTION_ERROR = 3,
};
extern const bool backchannelSupported;
......
......@@ -38,7 +38,7 @@ void emAfOtaImageDelete(void);
// Server CLI interface
#if !defined (EMBER_AF_PLUGIN_OTA_SERVER)
#define OTA_SERVER_COMMANDS
#define OTA_SERVER_COMMANDS
#endif
void otaImageNotifyCommand(void);
......@@ -21,9 +21,9 @@
// This relates all OTA command IDs in app/framework/gen/command-id.h
// to minimum message lengths (does not include EMBER_AF_ZCL_OVERHEAD)
PGM uint8_t emAfOtaMinMessageLengths[] = {
2, // Image Notify
2, // Image Notify
8, // Query Next Image Request
1, // Query Next Image Response
1, // Query Next Image Response
13, // Image Block Request
13, // Image Page Request
1, // Image Block Response (abort is shortest)
......@@ -48,14 +48,14 @@ EmberAfOtaImageId emAfOtaCreateEmberAfOtaImageIdStruct(uint16_t manufacturerId,
// This assumes the message has already been validated for its length
uint8_t emAfOtaParseImageIdFromMessage(EmberAfOtaImageId* returnId,
const uint8_t* buffer,
uint8_t length)
const uint8_t* buffer,
uint8_t length)
{
returnId->manufacturerId = emberAfGetInt16u(buffer, 0, length);
returnId->imageTypeId = emberAfGetInt16u(buffer, 2, length);
returnId->firmwareVersion = emberAfGetInt32u(buffer, 4, length);
MEMSET(returnId->deviceSpecificFileEui64, 0, EUI64_SIZE);
return 8;
returnId->manufacturerId = emberAfGetInt16u(buffer, 0, length);
returnId->imageTypeId = emberAfGetInt16u(buffer, 2, length);
returnId->firmwareVersion = emberAfGetInt32u(buffer, 4, length);
MEMSET(returnId->deviceSpecificFileEui64, 0, EUI64_SIZE);
return 8;
}
#if defined(EMBER_AF_PRINT_CORE)
......
......@@ -149,9 +149,9 @@ static PGM_P notifyArguments[] = {
emberCommandEntryTerminator(),
EmberCommandEntry emberAfPluginOtaServerCommands[] = {
OTA_SERVER_COMMANDS
OTA_SERVER_COMMANDS
emberCommandEntryTerminator(),
emberCommandEntryTerminator(),
};
#endif // EMBER_AF_GENERATE_CLI
......
......@@ -79,13 +79,13 @@ uint8_t getIndexForDownloadingNodeId(EmberNodeId nodeId)
void emAfOtaServerDynamicBlockPeriodInit()
{
// Initialize array to have no current OTA downloads
uint8_t nodeIndex;
for (nodeIndex = 0; nodeIndex < MAX_DOWNLOADS; nodeIndex++) {
downloadingNodes[nodeIndex].nodeId = EMBER_NULL_NODE_ID;
downloadingNodes[nodeIndex].unitDiscoveryState = STATE_NONE;
downloadingNodes[nodeIndex].msTickWhenLastSeen = 0;
}
// Initialize array to have no current OTA downloads
uint8_t nodeIndex;
for (nodeIndex = 0; nodeIndex < MAX_DOWNLOADS; nodeIndex++) {
downloadingNodes[nodeIndex].nodeId = EMBER_NULL_NODE_ID;
downloadingNodes[nodeIndex].unitDiscoveryState = STATE_NONE;
downloadingNodes[nodeIndex].msTickWhenLastSeen = 0;
}
}
void emAfOtaServerDynamicBlockPeriodTick()
......
......@@ -111,11 +111,11 @@ uint8_t emAfOtaPageRequestHandler(uint8_t clientEndpoint,
void emAfOtaPageRequestTick(uint8_t endpoint)
{
if (requesterNodeId == EMBER_NULL_NODE_ID) {
return;
}
if (requesterNodeId == EMBER_NULL_NODE_ID) {
return;
}
sendBlockRequest();
sendBlockRequest();
emberAfScheduleServerTickExtended(endpoint,
ZCL_OTA_BOOTLOAD_CLUSTER_ID,
requesterResponseSpacing,
......
......@@ -142,10 +142,10 @@ void emAfOtaImageDelete(void)
void emAfOtaReloadStorageDevice(void)
{
#if defined (EMBER_AF_PLUGIN_OTA_STORAGE_POSIX_FILESYSTEM)
emAfOtaStorageClose();
emAfOtaStorageClose();
#endif
emberAfOtaStorageInitCallback();
emberAfOtaStorageInitCallback();
}
#define PRINT_BLOCK_LENGTH 64
......
......@@ -39,18 +39,18 @@
EmberAfOtaImageId emAfOtaStorageGetImageIdFromHeader(const EmberAfOtaHeader* header)
{
EmberAfOtaImageId id = INVALID_OTA_IMAGE_ID;
id.manufacturerId = header->manufacturerId;
id.imageTypeId = header->imageTypeId;
id.firmwareVersion = header->firmwareVersion;
if (headerHasUpgradeFileDest(header)) {
MEMCOPY(id.deviceSpecificFileEui64,
&header->upgradeFileDestination,
EUI64_SIZE);
}
return id;
EmberAfOtaImageId id = INVALID_OTA_IMAGE_ID;
id.manufacturerId = header->manufacturerId;
id.imageTypeId = header->imageTypeId;
id.firmwareVersion = header->firmwareVersion;
if (headerHasUpgradeFileDest(header)) {
MEMCOPY(id.deviceSpecificFileEui64,
&header->upgradeFileDestination,
EUI64_SIZE);
}
return id;
}
uint16_t emGetUpgradeFileDestinationLength(uint16_t headerVersion)
......@@ -249,7 +249,7 @@ EmberAfOtaStorageStatus emAfOtaStorageReadAllTagInfo(const EmberAfOtaImageId* id
bool emberAfIsOtaImageIdValid(const EmberAfOtaImageId* idToCompare)
{
return (0 != MEMPGMCOMPARE(idToCompare,
&emberAfInvalidImageId,
sizeof(EmberAfOtaImageId)));
return (0 != MEMPGMCOMPARE(idToCompare,
&emberAfInvalidImageId,
sizeof(EmberAfOtaImageId)));
}
......@@ -40,18 +40,18 @@
#define TAG_OVERHEAD (2 + 4) // 2 bytes for the tag ID, 4 bytes for the length
#define isValidHeaderVersion(headerVersion) \
((headerVersion == OTA_HEADER_VERSION_ZIGBEE) || (headerVersion == OTA_HEADER_VERSION_THREAD))
((headerVersion == OTA_HEADER_VERSION_ZIGBEE) || (headerVersion == OTA_HEADER_VERSION_THREAD))
#define SECURITY_CREDENTIAL_VERSION_FIELD_PRESENT_MASK 0x0001
#define DEVICE_SPECIFIC_FILE_PRESENT_MASK 0x0002
#define HARDWARE_VERSIONS_PRESENT_MASK 0x0004
#define headerHasSecurityCredentials(header) \
((header)->fieldControl & SECURITY_CREDENTIAL_VERSION_FIELD_PRESENT_MASK)
((header)->fieldControl & SECURITY_CREDENTIAL_VERSION_FIELD_PRESENT_MASK)
#define headerHasUpgradeFileDest(header) \
((header)->fieldControl & DEVICE_SPECIFIC_FILE_PRESENT_MASK)
((header)->fieldControl & DEVICE_SPECIFIC_FILE_PRESENT_MASK)
#define headerHasHardwareVersions(header) \
((header)->fieldControl & HARDWARE_VERSIONS_PRESENT_MASK)
((header)->fieldControl & HARDWARE_VERSIONS_PRESENT_MASK)
// This size does NOT include the tag overhead.
#define SIGNATURE_TAG_DATA_SIZE (EUI64_SIZE + EMBER_SIGNATURE_SIZE)
......@@ -63,11 +63,11 @@
#define INVALID_EUI64 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
#define INVALID_OTA_IMAGE_ID \
{ INVALID_MANUFACTURER_ID, \
INVALID_DEVICE_ID, \
INVALID_FIRMWARE_VERSION, \
INVALID_EUI64, \
}
{ INVALID_MANUFACTURER_ID, \
INVALID_DEVICE_ID, \
INVALID_FIRMWARE_VERSION, \
INVALID_EUI64, \
}
#define INVALID_SLOT (uint32_t)-1
......
......@@ -3,12 +3,12 @@
typedef void (EmAfOtaStorageFileAddedHandler)(const EmberAfOtaHeader*);
typedef struct {
bool memoryDebug;
bool fileDebug;
bool fieldDebug;
bool ignoreFilesWithUnderscorePrefix;
bool printFileDiscoveryOrRemoval;
EmAfOtaStorageFileAddedHandler* fileAddedHandler;
bool memoryDebug;
bool fileDebug;
bool fieldDebug;
bool ignoreFilesWithUnderscorePrefix;
bool printFileDiscoveryOrRemoval;
EmAfOtaStorageFileAddedHandler* fileAddedHandler;
} EmAfOtaStorageLinuxConfig;
void emAfOtaStorageGetConfig(EmAfOtaStorageLinuxConfig* currentConfig);
......
......@@ -77,6 +77,6 @@ bool emberAfIsCurrentSecurityProfileSmartEnergy(void)
|| (emAfCurrentZigbeeProNetwork->securityProfile
== EMBER_AF_SECURITY_PROFILE_SE_FULL)));
#else
return false;
return false;
#endif
}
......@@ -545,16 +545,12 @@ int emberAfMain(MAIN_FUNCTION_PARAMETERS)
halInit();
INTERRUPTS_ON(); // Safe to enable interrupts at this point
{
int returnCode;
if (emberAfMainStartCallback(&returnCode,
APP_FRAMEWORK_MAIN_ARGUMENTS)) { //get serial port info
int returnCode;
if (emberAfMainStartCallback(&returnCode,
APP_FRAMEWORK_MAIN_ARGUMENTS)) { //get serial port info
return returnCode;
}
}
kk_print("*******************123****************\r\n");
kk_print_info("\r\n-----hello world![%s:%s]-----\r\n",__DATE__,__TIME__);
kk_print_version();
}
emberSerialInit(APP_SERIAL, BAUD_RATE, PARITY_NONE, 1); //fock child process
......
......@@ -379,6 +379,6 @@ EmberApsFrame *emberAfGetCommandApsFrame(void)
void emberAfSetCommandEndpoints(uint8_t sourceEndpoint, uint8_t destinationEndpoint)
{
emAfCommandApsFrame->sourceEndpoint = sourceEndpoint;
emAfCommandApsFrame->destinationEndpoint = destinationEndpoint;
emAfCommandApsFrame->sourceEndpoint = sourceEndpoint;
emAfCommandApsFrame->destinationEndpoint = destinationEndpoint;
}
......@@ -65,11 +65,11 @@ bool emAfProcessClusterSpecificCommand(EmberAfClusterCommand *cmd)
}
#endif
#ifdef ZCL_USING_OTA_BOOTLOAD_CLUSTER_SERVER
if (cmd->apsFrame->clusterId == ZCL_OTA_BOOTLOAD_CLUSTER_ID
&& cmd->direction == ZCL_DIRECTION_CLIENT_TO_SERVER
&& emberAfOtaServerIncomingMessageRawCallback(cmd)) {
return true;
}
if (cmd->apsFrame->clusterId == ZCL_OTA_BOOTLOAD_CLUSTER_ID
&& cmd->direction == ZCL_DIRECTION_CLIENT_TO_SERVER
&& emberAfOtaServerIncomingMessageRawCallback(cmd)) {
return true;
}
#endif
// Pass the command to the generated command parser for processing
......
......@@ -688,7 +688,7 @@ EmberStatus emberAfSendResponseWithCallback(EmberAfMessageSentFunction callback)
EmberStatus emberAfSendResponse(void)
{
return emberAfSendResponseWithCallback(NULL);
return emberAfSendResponseWithCallback(NULL);
}
EmberStatus emberAfSendImmediateDefaultResponseWithCallback(EmberAfStatus status,
......
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