Repair sensor apps and nbiot demo include
This commit is contained in:
parent
872f8bc9ca
commit
915c82552d
|
@ -28,7 +28,7 @@ Modification: Use file system functions
|
|||
|
||||
#include <sys/errno.h>
|
||||
#include <stdio.h>
|
||||
#include "../user_api/switch_api/user_api.h"
|
||||
#include <user_api.h>
|
||||
|
||||
int _close_r(struct _reent *ptr, int fd)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@ Author: AIIT XUOS Lab
|
|||
Modification: Use malloc, realloc, calloc and free functions
|
||||
*************************************************/
|
||||
|
||||
#include "../user_api/switch_api/user_api.h"
|
||||
#include <user_api.h>
|
||||
|
||||
void *_malloc_r (struct _reent *ptr, size_t size)
|
||||
{
|
||||
|
|
|
@ -28,8 +28,6 @@ extern void RegisterAdapterNBIoT(void);
|
|||
|
||||
void NbiotEnable(void)
|
||||
{
|
||||
RegisterAdapterNBIoT();
|
||||
|
||||
struct AdapterAT* at_adapter = ATAdapterFind(NBIOT_ADAPTER_ID);
|
||||
|
||||
UserTaskDelay(5000);
|
||||
|
|
|
@ -17,6 +17,7 @@ extern int SensorFrameworkInit(void);
|
|||
extern int RegisterAdapterEthernet(void);
|
||||
extern int RegisterAdapterWifi(void);
|
||||
extern int RegisterAdapterZigbee(void);
|
||||
extern int RegisterAdapterNBIoT(void);
|
||||
extern int LoraSx12xxSpiDeviceInit();
|
||||
|
||||
extern int D124VoiceInit(void);
|
||||
|
@ -100,6 +101,10 @@ static struct InitDesc connection_desc[] =
|
|||
#ifdef CONNECTION_COMMUNICATION_ZIGBEE
|
||||
{ "zigbee adpter", RegisterAdapterZigbee},
|
||||
#endif
|
||||
|
||||
#ifdef CONNECTION_COMMUNICATION_NB_IOT
|
||||
{ "NB-IoT adpter", RegisterAdapterNBIoT},
|
||||
#endif
|
||||
{ "NULL", NULL },
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include "../user_api/switch_api/user_api.h"
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include "../user_api/switch_api/user_api.h"
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include "../user_api/switch_api/user_api.h"
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include "../user_api/switch_api/user_api.h"
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* @date 2021.04.23
|
||||
*/
|
||||
|
||||
#include "../user_api/switch_api/user_api.h"
|
||||
#include <user_api.h>
|
||||
#include <sensor.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,10 @@
|
|||
#include "xs_adapter_at.h"
|
||||
#include "xs_adapter_at_agent.h"
|
||||
#include "xs_adapter_def.h"
|
||||
#include "../../../applications/user_api/switch_api/user_api.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <user_api.h>
|
||||
|
||||
#define MAX_SOCKET_NUM 8
|
||||
|
||||
|
|
|
@ -156,8 +156,11 @@ int NBIoTSocketCreate(struct AdapterAT *adapterAT, uint8_t socket_fd, uint8_t ty
|
|||
|
||||
printf("cmd : %s\n", at_cmd);
|
||||
ATOrderSend(adapterAT->agent, REPLY_TIME_OUT, reply, at_cmd);
|
||||
MdelayKTask(3000);
|
||||
printf("bak : %s\n", adapterAT->agent->maintain_buffer);
|
||||
UserTaskDelay(3000);
|
||||
printf("bak : ");
|
||||
for(int i = 0; i < strlen(reply->reply_buffer); i++)
|
||||
printf(" 0x%02x", reply->reply_buffer[i]);
|
||||
printf("\n");
|
||||
|
||||
struct Socket (*socketlist)[MAX_SOCKET_NUM] = &adapterAT->socket;
|
||||
memset(socketlist[socket_fd], 0, sizeof(struct Socket));
|
||||
|
@ -219,7 +222,7 @@ int NBIoTSocketConnect(struct AdapterAT *adapterAT , uint8_t socket_fd , struct
|
|||
|
||||
printf("cmd : %s\n", at_cmd);
|
||||
ATOrderSend(adapterAT->agent, REPLY_TIME_OUT, reply, at_cmd);
|
||||
MdelayKTask(300);
|
||||
UserTaskDelay(300);
|
||||
|
||||
socketlist[socket_fd]->dst_ip = dst_ip;
|
||||
socketlist[socket_fd]->dst_port = dst_port;
|
||||
|
@ -267,7 +270,7 @@ int NBIoTSocketClose(struct AdapterAT *adapterAT, uint8_t socket_fd )
|
|||
|
||||
printf("cmd : %s\n", at_cmd);
|
||||
ATOrderSend(adapterAT->agent, REPLY_TIME_OUT, reply, at_cmd);
|
||||
MdelayKTask(300);
|
||||
UserTaskDelay(300);
|
||||
|
||||
memset(socketlist[socket_fd], 0, sizeof(struct Socket));
|
||||
|
||||
|
@ -325,7 +328,7 @@ int NbiotSend(struct Adapter *padapter, const char* data, int len, bool block, i
|
|||
|
||||
printf("cmd : %s\n", at_cmd);
|
||||
ATOrderSend(adapterAT->agent, REPLY_TIME_OUT, reply, at_cmd);
|
||||
MdelayKTask(300);
|
||||
UserTaskDelay(300);
|
||||
|
||||
__exit:
|
||||
if (reply) {
|
||||
|
|
Loading…
Reference in New Issue