forked from xuos/xiuos
APP_Framework/Framework/: solve the problem the rebase cause.
This commit is contained in:
parent
33e3b798b7
commit
909f3cc635
|
@ -21,9 +21,11 @@
|
||||||
#include <adapter.h>
|
#include <adapter.h>
|
||||||
|
|
||||||
static DoublelistType adapter_list;
|
static DoublelistType adapter_list;
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
|
static int adapter_list_lock;
|
||||||
|
#else
|
||||||
static pthread_mutex_t adapter_list_lock;
|
static pthread_mutex_t adapter_list_lock;
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @description: Init adapter framework
|
* @description: Init adapter framework
|
||||||
* @return 0
|
* @return 0
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#endif
|
#endif
|
||||||
#ifdef ADD_RTTHREAD_FETURES
|
#ifdef ADD_RTTHREAD_FETURES
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
#endif
|
||||||
#define AT_CMD_MAX_LEN 128
|
#define AT_CMD_MAX_LEN 128
|
||||||
#define AT_AGENT_MAX 2
|
#define AT_AGENT_MAX 2
|
||||||
static char send_buf[AT_CMD_MAX_LEN];
|
static char send_buf[AT_CMD_MAX_LEN];
|
||||||
|
@ -439,6 +439,7 @@ int DeleteATAgent(ATAgentType agent)
|
||||||
printf("delete agent lock = %d\n",agent->lock.sem.semcount);
|
printf("delete agent lock = %d\n",agent->lock.sem.semcount);
|
||||||
PrivMutexDelete(&agent->lock);
|
PrivMutexDelete(&agent->lock);
|
||||||
}
|
}
|
||||||
|
#elif defined ADD_RTTHREAD_FETURES
|
||||||
#else
|
#else
|
||||||
if (agent->lock) {
|
if (agent->lock) {
|
||||||
printf("delete agent lock = %d\n",agent->lock);
|
printf("delete agent lock = %d\n",agent->lock);
|
||||||
|
@ -450,12 +451,12 @@ int DeleteATAgent(ATAgentType agent)
|
||||||
printf("delete agent entm_rx_notice = %d\n",agent->entm_rx_notice);
|
printf("delete agent entm_rx_notice = %d\n",agent->entm_rx_notice);
|
||||||
PrivSemaphoreDelete(&agent->entm_rx_notice);
|
PrivSemaphoreDelete(&agent->entm_rx_notice);
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
// if (agent->rsp_sem) {
|
if (agent->rsp_sem) {
|
||||||
// printf("delete agent rsp_sem = %d\n",agent->rsp_sem);
|
printf("delete agent rsp_sem = %d\n",agent->rsp_sem);
|
||||||
// PrivSemaphoreDelete(&agent->rsp_sem);
|
PrivSemaphoreDelete(&agent->rsp_sem);
|
||||||
// }
|
}
|
||||||
|
#endif
|
||||||
if (agent->maintain_buffer) {
|
if (agent->maintain_buffer) {
|
||||||
PrivFree(agent->maintain_buffer);
|
PrivFree(agent->maintain_buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,8 @@ struct ATAgent
|
||||||
uint32 maintain_len;
|
uint32 maintain_len;
|
||||||
uint32 maintain_max;
|
uint32 maintain_max;
|
||||||
|
|
||||||
#ifdef ADD_NUTTX_FETURES
|
#ifdef ADD_XIZI_FETURES
|
||||||
pthread_mutex_t lock;
|
int lock;
|
||||||
#else
|
#else
|
||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,34 +63,11 @@ struct ATAgent
|
||||||
char reply_end_last_char;
|
char reply_end_last_char;
|
||||||
char reply_end_char;
|
char reply_end_char;
|
||||||
uint32 reply_char_num;
|
uint32 reply_char_num;
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
|
int rsp_sem;
|
||||||
|
#else
|
||||||
sem_t rsp_sem;
|
sem_t rsp_sem;
|
||||||
|
#endif
|
||||||
pthread_t 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 timeout_s);
|
|
||||||
char *GetReplyText(ATReplyType reply);
|
|
||||||
int AtSetReplyEndChar(ATAgentType agent, char last_ch, char end_ch);
|
|
||||||
int AtSetReplyCharNum(ATAgentType agent, unsigned int num);
|
|
||||||
int AtSetReplyLrEnd(ATAgentType agent, char enable);
|
|
||||||
ATReplyType CreateATReply(uint32 reply_max_len);
|
|
||||||
unsigned int IpTint(char *ipstr);
|
|
||||||
void SwapStr(char *str, int begin, int end);
|
|
||||||
char* IpTstr(unsigned int ipint);
|
|
||||||
ATAgentType GetATAgent(const char *agent_name);
|
|
||||||
int InitATAgent(const char *agent_name, int fd, uint32 maintain_max);
|
|
||||||
int DeleteATAgent(ATAgentType agent);
|
|
||||||
int ParseATReply(char* str, const char *format, ...);
|
|
||||||
void DeleteATReply(ATReplyType reply);
|
|
||||||
|
|
||||||
pthread_t at_handler;
|
pthread_t at_handler;
|
||||||
|
|
||||||
#define ENTM_RECV_MAX 256
|
#define ENTM_RECV_MAX 256
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
|
|
||||||
#include <adapter.h>
|
#include <adapter.h>
|
||||||
#include "adapter_wifi.h"
|
#include "adapter_wifi.h"
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
#include <bus_pin.h>
|
#include <bus_pin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ADAPTER_HFA21_WIFI
|
#ifdef ADAPTER_HFA21_WIFI
|
||||||
extern AdapterProductInfoType Hfa21WifiAttach(struct Adapter *adapter);
|
extern AdapterProductInfoType Hfa21WifiAttach(struct Adapter *adapter);
|
||||||
|
@ -99,7 +100,7 @@ int AdapterWifiInit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************wifi TEST*********************/
|
/******************wifi TEST*********************/
|
||||||
int AdapterwifiTest(void)
|
int AdapterWifiTest(void)
|
||||||
{
|
{
|
||||||
char cmd[64];
|
char cmd[64];
|
||||||
int baud_rate = BAUD_RATE_57600;
|
int baud_rate = BAUD_RATE_57600;
|
||||||
|
@ -197,15 +198,18 @@ int wifiopen(void)
|
||||||
|
|
||||||
AdapterDeviceOpen(adapter);
|
AdapterDeviceOpen(adapter);
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, wifiopen, wifiopen, open adapter wifi );
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, wifiopen, wifiopen, open adapter wifi );
|
||||||
|
#endif
|
||||||
int wificlose(void)
|
int wificlose(void)
|
||||||
{
|
{
|
||||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
||||||
|
|
||||||
AdapterDeviceClose(adapter);
|
AdapterDeviceClose(adapter);
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, wificlose, wificlose, close adapter wifi );
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, wificlose, wificlose, close adapter wifi );
|
||||||
|
#endif
|
||||||
int wifisetup(int argc, char *argv[])
|
int wifisetup(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
||||||
|
@ -218,7 +222,9 @@ int wifisetup(int argc, char *argv[])
|
||||||
|
|
||||||
AdapterDeviceSetUp(adapter);
|
AdapterDeviceSetUp(adapter);
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifisetup, wifisetup, setup adapter wifi );
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifisetup, wifisetup, setup adapter wifi );
|
||||||
|
#endif
|
||||||
int wifiaddrset(int argc, char *argv[])
|
int wifiaddrset(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
||||||
|
@ -230,16 +236,18 @@ int wifiaddrset(int argc, char *argv[])
|
||||||
AdapterDevicePing(adapter, "36.152.44.95");///< ping www.baidu.com
|
AdapterDevicePing(adapter, "36.152.44.95");///< ping www.baidu.com
|
||||||
AdapterDeviceNetstat(adapter);
|
AdapterDeviceNetstat(adapter);
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(4)|SHELL_CMD_DISABLE_RETURN, wifiaddrset, wifiaddrset, addrset adapter wifi);
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(4)|SHELL_CMD_DISABLE_RETURN, wifiaddrset, wifiaddrset, addrset adapter wifi);
|
||||||
|
#endif
|
||||||
int wifiping(int argc, char *argv[])
|
int wifiping(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
||||||
printf("ping %s\n",argv[1]);
|
printf("ping %s\n",argv[1]);
|
||||||
AdapterDevicePing(adapter, argv[1]);
|
AdapterDevicePing(adapter, argv[1]);
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3), wifiping, wifiping, wifiping adapter );
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3), wifiping, wifiping, wifiping adapter );
|
||||||
|
#endif
|
||||||
int wificonnect(int argc, char *argv[])
|
int wificonnect(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
||||||
|
@ -258,7 +266,9 @@ int wificonnect(int argc, char *argv[])
|
||||||
|
|
||||||
AdapterDeviceConnect(adapter, net_role, ip, port, ip_type);
|
AdapterDeviceConnect(adapter, net_role, ip, port, ip_type);
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(4)|SHELL_CMD_DISABLE_RETURN, wificonnect, wificonnect, wificonnect adapter);
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(4)|SHELL_CMD_DISABLE_RETURN, wificonnect, wificonnect, wificonnect adapter);
|
||||||
|
#endif
|
||||||
int wifisend(int argc, char *argv[])
|
int wifisend(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
||||||
|
@ -270,7 +280,9 @@ int wifisend(int argc, char *argv[])
|
||||||
PrivTaskDelay(1000);
|
PrivTaskDelay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifisend, wifisend, wifisend adapter wifi information);
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifisend, wifisend, wifisend adapter wifi information);
|
||||||
|
#endif
|
||||||
int wifirecv(int argc, char *argv[])
|
int wifirecv(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME);
|
||||||
|
@ -282,4 +294,6 @@ int wifirecv(int argc, char *argv[])
|
||||||
printf("wifi recv [%s]\n",wifi_recv_msg);
|
printf("wifi recv [%s]\n",wifi_recv_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef ADD_XIZI_FETURES
|
||||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifirecv, wifirecv, wifirecv adapter wifi information);
|
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifirecv, wifirecv, wifirecv adapter wifi information);
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue