123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #include "includes.h"
- #include "bsp.h"
- #define VIR_WAIT_FOREVER (-1U)
- LSAPI_OSI_Pipe_t *at_rx_pipe = NULL;
- LSAPI_OSI_Pipe_t *at_tx_pipe = NULL;
- void vir_at_process(char *buf,unsigned int len)
- {
-
- if(sutApp.gtTMode==1)MSG_INFO(1,"vir_at--->%s",buf);
- if(msgCmp(buf, "SV")) {
- strcpy(sutApp.modemVer, buf);
- sutApp.modemVer[strlen(buf)-2]=0;
- }
-
- pocCmdHandler(buf+2,len-2);// bnd有回车换行 +2
- //cmdsProcess(buf+2,len-2);
- }
- //妯″潡搴旂瓟
- static void prvVirtAtRespCallback(void *param, unsigned event)
- {
- LSAPI_OSI_Pipe_t *pipe = (LSAPI_OSI_Pipe_t *)param;
- char buf[256];
-
- for (;;)
- {
- int bytes = LSAPI_OSI_PipeRead(pipe, buf, sizeof(buf)-1);
- if (bytes <= 0)
- break;
- buf[bytes] = '\0';
- // MSG_INFO(1,"VAT1:%d,%s",bytes,buf);
- vir_at_process(buf,bytes);
- }
- //MSG_INFO(1,"prvVirtAtRespCallback");
- }
- void makeupsample(void *param){
- at_rx_pipe = LSAPI_OSI_PipeCreate(1024);
- at_tx_pipe = LSAPI_OSI_PipeCreate(1024);
- LSAPI_OSI_PipeSetReaderCallback(at_tx_pipe, LSAPI_PIPE_EVENT_RX_ARRIVED,
- prvVirtAtRespCallback, at_tx_pipe);
- LSAPI_Device_AtVirtConfig_t cfg = {
- .name = LSAPI_MAKE_TAG('V', 'A', 'T', '1'),
- .rx_pipe = at_rx_pipe,
- .tx_pipe = at_tx_pipe,
- };
- LSAPI_Device_t *device = LSAPI_Device_AtVirtCreate(&cfg);
- LSAPI_Device_AtDispatch_t *dispatch = LSAPI_Device_AtDispatchCreate(device);
- LSAPI_Device_AtSetDispatch(device, dispatch);
- LSAPI_Device_Open(device);
- LSAPI_OSI_ThreadExit();
- }
- void CreateSerialAtThead()
- {
- if(NULL==LSAPI_OSI_ThreadCreate("virat", makeupsample, NULL, LSAPI_OSI_PRIORITY_NORMAL, 1024, 4))
- MSG_INFO(1,"virat thread create err");
- //涓嬮潰鐨勫欢鏃舵槸涓€瀹氳�鐨勶紝鍚﹀垯VAT1鐨勫洖璋冩棤娉曡繘鍏?
- //鎯呭喌鏄?濡傛灉涓嶅姞涓嬮潰鐨勫欢鏃讹紝鍙��鎵ц�bspStartNotice寰€涓插彛杈撳嚭鏁版嵁锛孷AT1灏辨棤娉曞洖璋冧簡
- LSAPI_OSI_ThreadSleep(500);
- }
- /*
- innerInfo
- 鍙戦€佹暟鎹�埌鍐呴儴(module)API
- */
- void innerInfo(unsigned char *info, unsigned int len){
- if(len>0){
- if(0>LSAPI_OSI_PipeWriteAll(at_rx_pipe, info, len, VIR_WAIT_FOREVER))
- MSG_INFO(1,"LSAPI_OSI_PipeWriteAll write failed");
- }
- }
- void msgToModem(char *p)
- {
- int len;
- len=strlen(p);
- innerInfo(p,len);
- }
|