123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- /********************************************************************************
- * File Name: Modem.h
- * Function Describe: Header file for Modem.c
- * Explain:
- * Writer: ShiLiangWen
- * Date: 2015-1-30
- *******************************************************************************/
- #ifndef __MODEM_H
- #define __MODEM_H
- /***********************************************************************************/
- #include <rtl.h>
- //Modem Power Ctrl
- #define MODEM_PWREN_PIN GPIO_Pin_1
- #define MODEM_PWREN_PORT GPIOB
- #define MODEM_PWREN_ENABLE MODEM_PWREN_PORT->BSRR = MODEM_PWREN_PIN
- #define MODEM_PWREN_DISABLE MODEM_PWREN_PORT->BRR = MODEM_PWREN_PIN
- //Modem Power Key
- #define MODEM_PWRKEY_PIN GPIO_Pin_6
- #define MODEM_PWRKEY_PORT GPIOB
- #define MODEM_PWRKEY_HIGH MODEM_PWRKEY_PORT->BRR = MODEM_PWRKEY_PIN
- #define MODEM_PWRKEY_LOW MODEM_PWRKEY_PORT->BSRR = MODEM_PWRKEY_PIN
- //Modem Reset
- #define MODEM_RESET_PIN GPIO_Pin_7
- #define MODEM_RESET_PORT GPIOB
- #define MODEM_RESET_HIGH MODEM_RESET_PORT->BRR = MODEM_RESET_PIN
- #define MODEM_RESET_LOW MODEM_RESET_PORT->BSRR = MODEM_RESET_PIN
- typedef enum {TIMEOUT=-1,SUCCEED=0,FAIL=1} M_RESULT;
- typedef enum {INVALID=0, OPENED=1,CLOSED=2} M_STATUE;
- //#define MODEM_POC_MSG_DATA_LEN 100
- //typedef struct{
- // unsigned short MsgLen;
- // unsigned char MsgData[MODEM_POC_MSG_DATA_LEN];
- //}SUT_MODEM_POC_MSG;
- #define MODEM_AT_MSG_DATA_LEN 255
- typedef struct{
- unsigned short MsgLen;
- unsigned char MsgData[MODEM_AT_MSG_DATA_LEN];
- }SUT_MODEM_AT_MSG;
- typedef void (*ModemAtHandle)(char *msg,unsigned short msglen);
- extern OS_MBX AtMsgBox;
- extern U32 AtMpool[];
- #define MODEM_AT_MSG_BUF 1300
- extern char ModemMsgBuf[MODEM_AT_MSG_BUF];
- char* strchrN(const char *str,char ch,int n);
- int GetSubFromStr(char *str,int n,char *val,unsigned short vallen);
- void ModemDelayAndDiscardMsg(int time);
- M_RESULT ModemSendToSocket(unsigned char socket,unsigned char *pData,unsigned short len);
- M_RESULT ModemGetCCID(char *pCCID);
- M_RESULT ModemGetCardStatus(void);
- M_RESULT ModemGetIMEI(char *pIMEI);
- M_RESULT WaitingForCReg(int second);
- M_RESULT ModemGetCSQ(unsigned char *CSQ);
- void ModemPowerOff(void);
- M_RESULT ModemGetPDP(void);
- M_RESULT ModemOpenPDP(void);
- M_RESULT ModemQueryPDP(void);
- M_RESULT ModemClosePDP(void);
- M_RESULT ModemGetSocket(int socket,int timeout);
- M_RESULT ModemOpenSocket(int socket,char *tcp_udp,char *server,unsigned short Port);
- M_RESULT ModemCloseSocket(int socket);
- M_RESULT ModemSetAPN(char *pApn,char *pUsrName, char *pUsrPass);
- M_RESULT ModemWaitOpened(int times);
- M_RESULT ModemInit(void);
- void ModemReboot(int t);
- void ModemSetAtResHandle(ModemAtHandle AtResHandle);
- int ModemStrCmp(char *msg,char *str);
- void ModemSendAT(char *p);
- M_RESULT ModemSetATE0(void);
- M_RESULT ModemGetIPbyDNS(char *Demain,unsigned char IP[4]);
- M_RESULT ModemSendToUdpSocket(unsigned char socket,unsigned char *pData,unsigned short len);
- #endif
- /***********************************************************************************/
|