fix zigbee compile problem when separate compiling

This commit is contained in:
gumj 2021-04-29 16:04:49 +08:00
parent d88e575a99
commit caace9f454
4 changed files with 24 additions and 15 deletions

View File

@ -22,7 +22,8 @@
#include <string.h> #include <string.h>
#include <xs_klist.h> #include <xs_klist.h>
#include <xs_adapter_manager.h> #include <xs_adapter_manager.h>
#include "../applications/user_api/switch_api/user_api.h" #include <user_api.h>
#include <string.h>
static int re_sem; static int re_sem;
static int buff_sem; static int buff_sem;
@ -77,9 +78,10 @@ void ZigbeeReceiveDemo(int argc, char *argv[])
} }
#ifndef SEPARATE_COMPILE
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
ZigbeeReceiveDemo, ZigbeeReceiveDemo, zigbee receive function ); ZigbeeReceiveDemo, ZigbeeReceiveDemo, zigbee receive function );
#endif

View File

@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include <xs_klist.h> #include <xs_klist.h>
#include <xs_adapter_manager.h> #include <xs_adapter_manager.h>
#include <string.h>
adapter_t padapter; adapter_t padapter;
/* a demo function to send message through command line using zigbee*/ /* a demo function to send message through command line using zigbee*/
/* first open zigbee to start demo*/ /* first open zigbee to start demo*/
@ -32,20 +32,21 @@ void ZigbeeOpenDemo()
// adapter_t padapter = ZigbeeAdapterFind("zigbee"); // adapter_t padapter = ZigbeeAdapterFind("zigbee");
padapter = ZigbeeAdapterFind("zigbee"); padapter = ZigbeeAdapterFind("zigbee");
if (NONE == padapter){ if (NONE == padapter){
KPrintf("adapter find failed!\n"); printf("adapter find failed!\n");
return; return;
} }
/*Open adapter*/ /*Open adapter*/
if (0 != padapter->done.NetAiitOpen(padapter)){ if (0 != padapter->done.NetAiitOpen(padapter)){
KPrintf("adapter open failed!\n"); printf("adapter open failed!\n");
return; return;
} }
} }
#ifndef SEPARATE_COMPILE
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
ZigbeeOpenDemo, ZigbeeOpenDemo, zigbee send function ); ZigbeeOpenDemo, ZigbeeOpenDemo, zigbee send function );
#endif
void ZigbeeSendDemo(int argc, char *argv[]) void ZigbeeSendDemo(int argc, char *argv[])
{ {
@ -54,8 +55,9 @@ void ZigbeeSendDemo(int argc, char *argv[])
padapter->done.NetAiitSend(padapter, argv[1], strlen(argv[1]) ,true,10000,0, NULL,&v,NULL); padapter->done.NetAiitSend(padapter, argv[1], strlen(argv[1]) ,true,10000,0, NULL,&v,NULL);
} }
#ifndef SEPARATE_COMPILE
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
ZigbeeSendDemo, ZigbeeSendDemo, zigbee send function ); ZigbeeSendDemo, ZigbeeSendDemo, zigbee send function );
#endif

View File

@ -20,7 +20,7 @@
*/ */
#include <xs_adapter_zigbee.h> #include <xs_adapter_zigbee.h>
#include <xs_adapter_manager.h> #include <xs_adapter_manager.h>
#include <string.h>
/* initialize to the register list*/ /* initialize to the register list*/
int RegisterAdapterZigbee(void) int RegisterAdapterZigbee(void)
{ {

View File

@ -20,10 +20,14 @@
*/ */
#include "xs_adapter_zigbee.h" #include "xs_adapter_zigbee.h"
#include "../applications/user_api/switch_api/user_api.h" // #include "../applications/user_api/switch_api/user_api.h"
#include "../applications/user_api/include/bus_serial.h" // #include "../applications/user_api/include/bus_serial.h"
#include "../applications/user_api/include/dev_serial.h" // #include "../applications/user_api/include/dev_serial.h"
#include <user_api.h>
#include <bus_serial.h>
#include <dev_serial.h>
#include <string.h>
#ifdef CONNECTION_COMMUNICATION_ZIGBEE_AIIT #ifdef CONNECTION_COMMUNICATION_ZIGBEE_AIIT
#define SAMPLE_UART_NAME "/dev/extuart_dev0" #define SAMPLE_UART_NAME "/dev/extuart_dev0"
int use_aiit = 1; int use_aiit = 1;
@ -63,9 +67,9 @@ int ZigbeeOpen(struct Adapter *padapter)
cfg.port_configure = 0; cfg.port_configure = 0;
} }
ioctl(serial_fd, OPE_INT, &cfg); ioctl(serial_fd, 0, &cfg);
UserTaskDelay(1000); UserTaskDelay(1000);
KPrintf("Zigbee ready\n"); printf("Zigbee ready\n");
return 0; return 0;
} }
@ -157,11 +161,12 @@ void ZigbeeSettingDemo(int argc, char *argv[])
UserTaskDelay(500); UserTaskDelay(500);
write(serial_fd,set5,strlen(set5)); write(serial_fd,set5,strlen(set5));
UserTaskDelay(500); UserTaskDelay(500);
KPrintf("zigbee setting success!\n"); printf("zigbee setting success!\n");
} }
#ifndef SEPARATE_COMPILE
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),
ZigbeeSettingDemo, ZigbeeSettingDemo, zigbee send function ); ZigbeeSettingDemo, ZigbeeSettingDemo, zigbee send function );
#endif
void ZigbeeClose(struct Adapter *padapter) void ZigbeeClose(struct Adapter *padapter)
{ {