forked from xuos/xiuos
First commit XiUOS
This commit is contained in:
72
framework/connection/Adapter/include/xs_adapter.h
Normal file
72
framework/connection/Adapter/include/xs_adapter.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file xs_adapter.h
|
||||
* @brief Adapter interface
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.22
|
||||
*/
|
||||
|
||||
#ifndef XS_ADAPTER_N
|
||||
#define XS_ADAPTER_N
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <xs_klist.h>
|
||||
#include <xs_adapter_def.h>
|
||||
|
||||
|
||||
|
||||
enum AdapterType {
|
||||
ADAPTER_LORA = 0, /* Lora */
|
||||
ADAPTER_4G , /* 4G */
|
||||
ADAPTER_NBIOT , /* _NBIot */
|
||||
ADAPTER_WIFI , /* WIFI */
|
||||
ADAPTER_ETHERNET , /* ETHERNET */
|
||||
ADAPTER_BLUETOOTH , /* BLUETOOTH */
|
||||
ADAPTER_ZIGBEE , /* ZIGBEE */
|
||||
ADAPTER_5G , /* 5G */
|
||||
};
|
||||
enum MeshType{
|
||||
NET_P2P = 0,
|
||||
NET_ADHOC_SINGLE_GROUP,
|
||||
NET_ADHOC_MULTI_GROUP,
|
||||
};
|
||||
|
||||
enum NetRoleType{
|
||||
ROLE_TYPE_SLAVE = 1,
|
||||
ROLE_TYPE_MASTER,
|
||||
ROLE_TYPE_NONE,
|
||||
};
|
||||
|
||||
struct Adapter;
|
||||
struct AdapterDone {
|
||||
void (*NetAiitClose)(struct Adapter *padapter);
|
||||
int (*NetAiitOpen)(struct Adapter *padapter);
|
||||
int (*NetAiitJoin)(struct Adapter *padapter, int dev_type, char* net_id);
|
||||
int (*NetAiitSend)(struct Adapter *padapter, const char* data, int len, bool block, int time_out, int delay, send_success cb, void* param, void* reserved);
|
||||
int (*NetAiitReceive)(struct Adapter *padapter, char* rev_buffer, int buffer_len,int time_out, bool block, void* reserved);
|
||||
int (*NetAiitIoctl)(struct Adapter *padapter, int cmd, void *arg);
|
||||
};
|
||||
|
||||
struct Adapter
|
||||
{
|
||||
enum AdapterType type; /* type of adapter, such as lora adapter */
|
||||
enum NetRoleType net_role_type;
|
||||
enum MeshType mesh_type;
|
||||
struct AdapterDone done; /* socket-like APIs for data transferring */
|
||||
struct SysDoubleLinklistNode link; /* link list node */
|
||||
};
|
||||
typedef struct Adapter *adapter_t;
|
||||
|
||||
#endif
|
||||
94
framework/connection/Adapter/include/xs_adapter_at.h
Normal file
94
framework/connection/Adapter/include/xs_adapter_at.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file xs_adapter_at.h
|
||||
* @brief AdapterAT interface
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.22
|
||||
*/
|
||||
|
||||
#ifndef XS_ADAPTER_AT_H
|
||||
#define XS_ADAPTER_AT_H
|
||||
|
||||
#include "xs_adapter.h"
|
||||
#include <xs_adapter_at_agent.h>
|
||||
|
||||
#define SOCKET_STATUS_UNUSED (0)
|
||||
#define SOCKET_STATUS_INIT (1)
|
||||
#define SOCKET_STATUS_CONNECT (2)
|
||||
|
||||
#define SOCKET_TYPE_DGRAM (0)
|
||||
#define SOCKET_TYPE_STREAM (1)
|
||||
|
||||
#define SOCKET_PROTOCOL_TCP (6)
|
||||
#define SOCKET_PROTOCOL_UDP (17)
|
||||
|
||||
#define NET_TYPE_AF_INET (0)
|
||||
#define NET_TYPE_AF_INET6 (1)
|
||||
|
||||
#define SOCKET_MAX 8
|
||||
|
||||
struct Socket
|
||||
{
|
||||
uint8_t fd;
|
||||
uint8_t status ;
|
||||
struct ADDRESS_IPV4 src_ip;
|
||||
uint16_t src_port;
|
||||
struct ADDRESS_IPV4 dst_ip;
|
||||
uint16_t dst_port;
|
||||
uint8_t type;
|
||||
uint8_t af_type;
|
||||
uint8_t protocal;
|
||||
uint8 is_client;
|
||||
};
|
||||
|
||||
struct AdapterAT;
|
||||
struct ATDone
|
||||
{
|
||||
int (*ATOperateUp)(struct AdapterAT *adapterAT);
|
||||
int (*ATOperateDown)(struct AdapterAT *adapterAT);
|
||||
int (*ATOperateAddr)(struct AdapterAT *adapterAT, uint ip, uint gateway, uint netmask);
|
||||
int (*ATOperateDns)(struct AdapterAT *adapterAT, struct ADDRESS_IPV4 *dns_addr, uint8 dns_count);
|
||||
int (*ATOperateDHCP)(struct AdapterAT *adapterAT, bool enable);
|
||||
int (*ATPing)(struct AdapterAT *adapterAT, const char *destination, struct ping_result *ping_resp);
|
||||
int (*ATNetstat)(struct AdapterAT *adapterAT);
|
||||
int (*ATOperateDefault)(struct AdapterAT *adapterAT);
|
||||
|
||||
int (*ATSocketCreate)(struct AdapterAT *adapterAT , uint8_t socket_fd , uint8_t type , uint8_t af_type );
|
||||
int (*ATSocketConnect)(struct AdapterAT *adapterAT , uint8_t socket_fd , struct ADDRESS_IPV4 dst_ip , uint16_t dst_port, uint8 is_client);
|
||||
int (*ATSocketClose)(struct AdapterAT *adapterAT , uint8_t socket_fd );
|
||||
};
|
||||
|
||||
struct AdapterAT {
|
||||
struct Adapter parent;
|
||||
struct ATAgent *agent;
|
||||
struct ADDRESS_IPV4 ip;
|
||||
struct ADDRESS_IPV4 netmask;
|
||||
struct ADDRESS_IPV4 gateway;
|
||||
struct ADDRESS_IPV4 dns[DNS_COUNT];
|
||||
uint32 at_adapter_id;
|
||||
struct Socket socket[SOCKET_MAX];
|
||||
uint8 hardware_address_len;
|
||||
uint8 hardware_address[HW_MAX];
|
||||
uint16 flags;
|
||||
uint16 mtu;
|
||||
|
||||
void (*change_cb )(struct AdapterAT *adapterAT, enum cb_type type, enum change_type ch_type_);
|
||||
|
||||
struct ATDone atdone;
|
||||
|
||||
struct SysDoubleLinklistNode link;
|
||||
};
|
||||
|
||||
#endif
|
||||
81
framework/connection/Adapter/include/xs_adapter_at_agent.h
Normal file
81
framework/connection/Adapter/include/xs_adapter_at_agent.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file xs_adapter_at_agent.h
|
||||
* @brief AT proxy, auto receive AT reply and transparency data
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.22
|
||||
*/
|
||||
|
||||
#ifndef XS_ADAPTER_AT_CLIENT_H
|
||||
#define XS_ADAPTER_AT_CLIENT_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <bus_serial.h>
|
||||
|
||||
enum ReceiveMode
|
||||
{
|
||||
ENTM_MODE = 1,
|
||||
AT_MODE = 2,
|
||||
};
|
||||
|
||||
struct ATReply
|
||||
{
|
||||
char *reply_buffer;
|
||||
uint32 reply_max_len;
|
||||
uint32 reply_len;
|
||||
};
|
||||
typedef struct ATReply *ATReplyType;
|
||||
|
||||
struct ATAgent
|
||||
{
|
||||
char agent_name[NAME_NUM_MAX];
|
||||
int fd;
|
||||
|
||||
char *maintain_buffer;
|
||||
uint32 maintain_len;
|
||||
uint32 maintain_max;
|
||||
|
||||
int32 lock;
|
||||
|
||||
ATReplyType reply;
|
||||
int rsp_sem;
|
||||
|
||||
int32 at_handler;
|
||||
|
||||
#define ENTM_RECV_MAX 256
|
||||
char entm_recv_buf[ENTM_RECV_MAX];
|
||||
uint32 entm_recv_len;
|
||||
enum ReceiveMode receive_mode;
|
||||
int entm_rx_notice;
|
||||
};
|
||||
typedef struct ATAgent *ATAgentType;
|
||||
|
||||
int EntmSend(ATAgentType agent, const char *data, int len);
|
||||
int EntmRecv(ATAgentType agent, char *rev_buffer, int buffer_len, int time_out);
|
||||
char *GetReplyText(ATReplyType reply);
|
||||
ATReplyType CreateATReply(uint32 reply_max_len);
|
||||
uint IpTint(char *ipstr);
|
||||
void SwapStr(char *str, int begin, int end);
|
||||
char* IpTstr(uint ipint);
|
||||
ATAgentType GetATAgent(const char *agent_name);
|
||||
int InitATAgent(const char *agent_name, const char *device_name, uint32 maintain_max, struct SerialCfgParam* pserial_cfg);
|
||||
int ParseATReply(char* str, const char *format, ...);
|
||||
void DeleteATReply(ATReplyType reply);
|
||||
int ATOrderSend(ATAgentType agent, uint32 timeout, ATReplyType reply, const char *cmd_expr, ...);
|
||||
|
||||
#define REPLY_TIME_OUT 3000
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file xs_adapter_at_ethernet.h
|
||||
* @brief Structure and function declarations of the connection ethernet
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.22
|
||||
*/
|
||||
|
||||
#ifndef XS_ADAPTER_AT_ETHERNET_H
|
||||
#define XS_ADAPTER_AT_ETHERNET_H
|
||||
|
||||
#include "xs_adapter.h"
|
||||
#include "xs_adapter_at.h"
|
||||
#include "xs_adapter_def.h"
|
||||
#include "xs_klist.h"
|
||||
|
||||
struct AdapterEthernet {
|
||||
struct AdapterAT parent; /* inherit from Adapter */
|
||||
|
||||
char vendor_name[NAME_LEN_MAX];
|
||||
char product_ID_ethernet[NAME_LEN_MAX];
|
||||
|
||||
struct SingleLinklistNode link;
|
||||
};
|
||||
|
||||
void EthernetClose(struct Adapter *padapter);
|
||||
int EthernetOpen(struct Adapter *padapter);
|
||||
int EthernetSend(struct Adapter *padapter, const char *data, int len, bool block, int time_out, int delay, send_success cb, void *param, void *p);
|
||||
int EthernetReceive(struct Adapter *padapter, char *rev_buffer, int buffer_len, int time_out, bool block, void *p);
|
||||
|
||||
int EthernetSetUp(struct AdapterAT *adapterAT);
|
||||
int EthernetDHCP(struct AdapterAT *adapterAT, bool enable);
|
||||
int EthernetPing(struct AdapterAT *adapterAT, const char *destination, struct ping_result *ping_resp);
|
||||
int EthernetNetstat(struct AdapterAT *adapterAT);
|
||||
|
||||
#endif
|
||||
50
framework/connection/Adapter/include/xs_adapter_at_wifi.h
Normal file
50
framework/connection/Adapter/include/xs_adapter_at_wifi.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file xs_adapter_at_wifi.h
|
||||
* @brief Structure and function declarations of the connection wifi
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.22
|
||||
*/
|
||||
|
||||
#ifndef XS_ADAPTER_AT_WIFI_H
|
||||
#define XS_ADAPTER_AT_WIFI_H
|
||||
|
||||
#include "xs_adapter.h"
|
||||
#include "xs_adapter_at.h"
|
||||
#include "xs_adapter_def.h"
|
||||
#include "xs_klist.h"
|
||||
|
||||
struct Adapterwifi {
|
||||
struct AdapterAT parent; /* inherit from Adapter */
|
||||
|
||||
char vendor_name[NAME_LEN_MAX];
|
||||
char product_id_wifi[NAME_LEN_MAX];
|
||||
|
||||
struct SingleLinklistNode link;
|
||||
};
|
||||
|
||||
void WifiClose(struct Adapter *padapter);
|
||||
int WifiOpen(struct Adapter *padapter);
|
||||
int WifiSend(struct Adapter *padapter, const char *data, int len, bool block, int time_out, int delay, send_success cb, void *param, void *p);
|
||||
int WifiReceive(struct Adapter *padapter, char *rev_buffer, int buffer_len, int time_out, bool block, void *p);
|
||||
|
||||
int WifiSetUp(struct AdapterAT *adapter_at);
|
||||
int WifiSetDown(struct AdapterAT *adapter_at);
|
||||
int WifiSetAddr(struct AdapterAT *adapter_at, uint ip, uint gateway, uint netmask);
|
||||
int WifiDHCP(struct AdapterAT *adapter_at, bool enable);
|
||||
int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct ping_result *ping_resp);
|
||||
int WifiNetstat(struct AdapterAT *adapter_at);
|
||||
|
||||
#endif
|
||||
76
framework/connection/Adapter/include/xs_adapter_def.h
Normal file
76
framework/connection/Adapter/include/xs_adapter_def.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file xs_adapter_def.h
|
||||
* @brief defines about adapter
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.22
|
||||
*/
|
||||
|
||||
#ifndef __XS_ADAPTER_DEF_H__
|
||||
#define __XS_ADAPTER_DEF_H__
|
||||
|
||||
#include "stdbool.h"
|
||||
|
||||
typedef void(*send_success)(void* param);
|
||||
|
||||
#define NAME_LEN_MAX 32
|
||||
|
||||
#define IPV6__ADDRESS_COUNT 3U
|
||||
#define DNS_COUNT 2U
|
||||
#define HW_MAX 8U
|
||||
|
||||
enum cb_type
|
||||
{
|
||||
CB_ADDR_IP, /* IP address */
|
||||
CB_ADDR_NETMASK, /* subnet mask */
|
||||
CB_ADDR_GATEWAY, /* netmask */
|
||||
CB_ADDR_DNS_SERVER, /* dns server */
|
||||
CB_STATUS_UP, /* changed to 'up' */
|
||||
CB_STATUS_DOWN, /* changed to 'down' */
|
||||
CB_STATUS_LINK_UP, /* changed to 'link up' */
|
||||
CB_STATUS_LINK_DOWN, /* changed to 'link down' */
|
||||
CB_STATUS_INTERNET_UP, /* changed to 'internet up' */
|
||||
CB_STATUS_INTERNET_DOWN, /* changed to 'internet down' */
|
||||
CB_STATUS_DHCP_ENABLE, /* enable DHCP capability */
|
||||
CB_STATUS_DHCP_DISABLE, /* disable DHCP capability */
|
||||
};
|
||||
|
||||
enum change_type
|
||||
{
|
||||
addr_change,
|
||||
status_change,
|
||||
};
|
||||
|
||||
struct ADDRESS_IPV4
|
||||
{
|
||||
uint32 ipv4;
|
||||
};
|
||||
|
||||
struct ping_result
|
||||
{
|
||||
struct ADDRESS_IPV4 ip_addr; /* response IP address */
|
||||
uint16 data_len; /* response data length */
|
||||
uint16 ttl; /* time to live */
|
||||
uint32 ticks; /* response time, unit tick */
|
||||
void *UserData; /* user-specific data */
|
||||
};
|
||||
|
||||
#define ETHERNET_ADAPTER_ID 0x03U
|
||||
#define WIFI_ADAPTER_ID 0x04U
|
||||
#define fourG_ADAPTER_ID 0x05U
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
40
framework/connection/Adapter/include/xs_adapter_manager.h
Normal file
40
framework/connection/Adapter/include/xs_adapter_manager.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file xs_adapter_manager.h
|
||||
* @brief manager adapter list
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021.04.22
|
||||
*/
|
||||
|
||||
#ifndef ADAPTER_MANAGER_H_
|
||||
#define ADAPTER_MANAGER_H_
|
||||
#include "xs_adapter.h"
|
||||
#include <xs_adapter_at.h>
|
||||
|
||||
void LoraAdapterInit();
|
||||
void LoraAdapterRegister(adapter_t padapter);
|
||||
void* LoraAdapterFind(char* name);
|
||||
|
||||
|
||||
void ATAdapterInit();
|
||||
void ATAdapterRegister(struct AdapterAT* at_adapter);
|
||||
void* ATAdapterFind(uint32 adapter_id);
|
||||
|
||||
void ZigbeeAdapterInit();
|
||||
void ZigbeeAdapterRegister(adapter_t padapter);
|
||||
void* ZigbeeAdapterFind(char* name);
|
||||
|
||||
|
||||
#endif
|
||||
41
framework/connection/Adapter/include/xs_adapter_zigbee.h
Normal file
41
framework/connection/Adapter/include/xs_adapter_zigbee.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2020 AIIT XUOS Lab
|
||||
* XiUOS is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file: xs_adapter_zigbee.h
|
||||
* @brief: head file
|
||||
* @version: 1.0
|
||||
* @author: AIIT XUOS Lab
|
||||
* @date: 2020/4/25
|
||||
*
|
||||
*/
|
||||
#ifndef XS_ADAPTER_ZIGBEE_H
|
||||
#define XS_ADAPTER_ZIGBEE_H
|
||||
#include "xs_adapter.h"
|
||||
|
||||
struct AdapterZigbee {
|
||||
struct Adapter parent; /* inherit from Adapter */
|
||||
const char * name; /* name of the adapter instance */
|
||||
|
||||
const char * device_type; /* type of the adapter instance */
|
||||
|
||||
|
||||
};
|
||||
typedef struct AdapterZigbee *adapterZigbee_t;
|
||||
|
||||
int ZigbeeOpen(struct Adapter *padapter);
|
||||
int ZigbeeSend(struct Adapter *padapter, const char* data, int len, bool block, int time_out, int delay, send_success cb, void* param, void* reserved);
|
||||
int ZigbeeReceive(struct Adapter *padapter, char* rev_buffer, int buffer_len,int time_out, bool block, void* reserved);
|
||||
void ZigbeeClose(struct Adapter *padapter);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user