// used void FromPC(char * buf) { usbprog.datatogl=0; SendHex(buf[0]); SendHex(buf[1]); SendHex(buf[2]); int i; for(i=0; i<64; i++) answer[i]=0; answer[0]=0x02; answer[1]=0x0A; CommandAnswer(64); }
void _USBNGetDescriptor(DeviceRequest *req) { unsigned char index = req->wValue; unsigned char type = req->wValue >> 8; EP0tx.Index = 0; EP0tx.DataPid = 1; switch (type) { case DEVICE: #if DEBUG USBNDebug("DEVICE DESCRIPTOR\n\r"); #endif EP0tx.Size = DeviceDescriptor[0]; EP0tx.Buf = DeviceDescriptor; // first get descriptor request is // always be answered with first 8 unsigned chars of dev descriptor if(req->wLength==0x40) EP0tx.Size = 8; break; case CONFIGURATION: #if DEBUG USBNDebug("CONFIGURATION DESCRIPTOR "); #endif // send complete tree EP0tx.Size =req->wLength; EP0tx.Buf = ConfigurationDescriptor; break; #if 0 case STRING: #if DEBUG USBNDebug("STRING DESCRIPTOR "); SendHex(index); USBNDebug("\r\n"); #endif if(index ==1) { EP0tx.Buf = &FinalStringArray[index][0]; EP0tx.Size = EP0tx.Buf[0]; } else { char lang[]={0x04,0x03,0x09,0x04}; EP0tx.Size=4; EP0tx.Buf=lang; } break; #endif } //if (EP0rx.Buf[7]==0) //if less than 256 req'd // if (EP0tx.Size > EP0rx.Buf[6]) EP0tx.Size = EP0rx.Buf[6]; _USBNTransmit(&EP0tx); }
void Senddata() { unsigned int i; Outdata[0]=(unsigned char)LEFT; Outdata[1]=(unsigned char)RIGHT; Outdata[2]=(unsigned char)speed_target ; Outdata[3]=(unsigned char)currentspeed; Outdata[4]=(unsigned char)(LEFT>>8); Outdata[5]=(unsigned char)(RIGHT>>8); Outdata[6]=(unsigned char)(speed_target >>8); Outdata[7]=(unsigned char)(currentspeed>>8); LINFlex_TX('='); LINFlex_TX('='); for(i=0;i<8;i++) { SendHex(Outdata[i]); if(i==3) { LINFlex_TX('f'); LINFlex_TX('f'); } } }
/************************************************************************* * 函数名称:SendImageData * 功能说明: * 参数说明: * 函数返回:无 * 修改时间:2012-10-20 * 备 注: *************************************************************************/ void SendImageData(unsigned char * ImageData) { unsigned char i; unsigned char crc = 0; /* Send Data */ UART_SendData(UART0, '*'); UART_SendData(UART0, 'L'); UART_SendData(UART0, 'D'); SendHex(0); SendHex(0); SendHex(0); SendHex(0); for(i=0; i<128; i++) { SendHex(*ImageData++); } SendHex(crc); UART_SendData(UART0,'#'); }
//this is only my debug tool void Terminal(char cmd) { char h,l; unsigned char tmp; int i; struct list_entry *ptr; char *values; switch(cmd) { case 'i': USBNStart(); break; // write to usb register case 'w': //UARTWrite("write to USB reg:"); //USBNDEBUGPRINT("write to USB reg:"); h = UARTGetChar(); l = UARTGetChar(); SendHex(AsciiToHex(h,l)); tmp = AsciiToHex(h,l); UARTWrite("value:"); h = UARTGetChar(); l = UARTGetChar(); SendHex(AsciiToHex(h,l)); //USBNWrite(tmp,AsciiToHex(h,l)); UARTWrite("result:"); SendHex(USBNRead(tmp)); UARTWrite("\r\n"); break; // read from usb register case 'r': UARTWrite("read USB reg:"); h = UARTGetChar(); l = UARTGetChar(); SendHex(AsciiToHex(h,l)); UARTWrite("->"); SendHex(USBNRead(AsciiToHex(h,l))); UARTWrite("\r\n"); break; case 'h': UARTWrite("i usbn init procedure\r\n"); UARTWrite("w write USBN Register <h,l>(address) <h,l> (value) e.g 05 00\r\n"); UARTWrite("r read USBN Register <h,l> e.g. 02 ( RID)\r\n"); UARTWrite("s show all USBN Registers\r\n"); UARTWrite("b send test data from func to host\r\n"); UARTWrite("d show descriptors\r\n"); break; // show all registers case 's': for(i=0;i<=63;i++) { SendHex(i); UARTWrite("->"); SendHex(USBNRead(i)); UARTWrite("\r\n"); } break; case 'd': USBNDebug("\r\nDescriptor List\r\n"); ptr = DescriptorList; while(ptr != NULL) { values = (char*)ptr->data; SendHex(ptr->type); SendHex(ptr->len); SendHex(ptr->conf); SendHex(ptr->interf); USBNDebug(" "); for(i=0;i<ptr->len;i++) SendHex(values[i]); USBNDebug("\r\n"); ptr=ptr->next; } break; case 'b': UARTWrite("send test data from fifo1\r\n"); int j,i; char stat; USBNWrite(TXC1,FLUSH); USBNWrite(TXD1,0x01); for(j=0;j<63;j++) USBNBurstWrite((unsigned char)j); USBNWrite(TXC1,TX_LAST+TX_EN); //USBNWrite(TXC1,TX_LAST+TX_EN+TX_TOGL); break; case 'p': USBNWrite(TXC1,TX_LAST+TX_EN); break; default: UARTWrite("unknown command\r\n"); } }
// ******************************************************************** // Receive and Transmit functions for EPs // ******************************************************************** void _USBNReceiveFIFO0(void) { unsigned char rxstatus; char Buf[8]; DeviceRequest *req; int i; #if DEBUG USBNDebug("rx\r\n"); #endif rxstatus = USBNRead(RXS0); if(rxstatus & SETUP_R) { for(i=0;i<8;i++){ Buf[i] = USBNRead(EP0rx.usbnData); } #if DEBUG for(i=0;i<8;i++) SendHex(Buf[i]); // type - get descr or set address USBNDebug("\r\n"); #endif req = (DeviceRequest*)(Buf); USBNWrite(RXC0,FLUSH); // make sure the RX is off USBNWrite(TXC0,FLUSH); // make sure the TX is off USBNWrite(EPC0,USBNRead(EPC0)&0x7F); // turn of stall switch (req->bmRequestType & 0x60) // decode request type { case DO_STANDARD: // standard request USBNDebug("HALLO STANDARD "); SendHex(req->bRequest); USBNDebug("\n\r"); switch (req->bRequest) // decode request code { case CLR_FEATURE: #if DEBUG USBNDebug("CLR FEATURE\n\r"); #endif //_USBNClearFeature(req); break; case GET_CONFIGURATION: #if DEBUG //USBNDebug("GET CONFIG\n\r"); #endif _USBNGetConfiguration(req); break; case GET_DESCRIPTOR: #if DEBUG USBNDebug("GET DESCRIPTOR\n\r"); #endif _USBNGetDescriptor(req); break; case GET_INTERFACE: #if DEBUG USBNDebug("GET INTERFACE\n\r"); #endif break; case GET_STATUS: #if DEBUG #endif USBNDebug("GET STATUS\n\r"); //_USBNGetStatus(req); USBNWrite(TXC0,FLUSH); USBNWrite(TXD0,1); USBNWrite(TXD0,0); USBNWrite(TXC0,TX_TOGL+TX_EN); //enable the TX (DATA1) break; case SET_ADDRESS: #if DEBUG USBNDebug("SET ADDRESS "); #endif _USBNSetAddress(req); break; case SET_CONFIGURATION: #if DEBUG USBNDebug("SET CONFIGURATION\n\r"); #endif _USBNSetConfiguration(req); break; case SET_FEATURE: #if DEBUG USBNDebug("SET FEATURE\n\r"); #endif USBNWrite(TXC0,TX_TOGL+TX_EN); //enable the TX (DATA1) break; case SET_INTERFACE: #if DEBUG USBNDebug("SET INTERFACE\n\r"); #endif USBNWrite(TXC0,TX_TOGL+TX_EN); //enable the TX (DATA1) break; default: // unsupported standard req #if DEBUG USBNDebug("unsupported standard req\n\r"); #endif USBNWrite(EPC0,USBNRead(EPC0)+STALL); // stall the endpoint break; } break; case DO_CLASS: // class request #if DEBUG USBNDebug("Class request\n\r"); #endif //USBNDecodeClassRequest(req); USBNWrite(TXC0,TX_TOGL+TX_EN); //enable the TX (DATA1) break; case DO_VENDOR: // vendor request #if DEBUG USBNDebug("Vendor request\n\r"); #endif USBNDecodeVendorRequest(req); USBNWrite(TXC0,TX_TOGL+TX_EN); //enable the TX (DATA1) break; default: // unsupported req type #if DEBUG USBNDebug("unsupported req type\r\n"); #endif USBNWrite(EPC0,USBNRead(EPC0)+STALL); // stall the endpoint break; } //the following is done for all setup packets. Note that if //no data was stuffed into the FIFO, the result of the fol- //lowing will be a zero-length response. // only for stage 2 transfers if(req->bmRequestType == 0x00) USBNWrite(TXC0,TX_TOGL+TX_EN); //enable the TX (DATA1) } else // if not a setuppacket { USBNDebug("error transmit\r\n"); if (EP0tx.Size > EP0tx.usbnfifo) // multi-pkt status stage? { if ((rxstatus& 0x5F)!=0x10) // length error?? { #if DEBUG USBNDebug("length error\r\n"); #endif } EP0tx.Size=0; // exit multi-packet mode USBNWrite(TXC0,FLUSH); // flush TX0 and disable USBNWrite(RXC0,RX_EN); // re-enable the receiver } } }
void _USBNGetDescriptor(DeviceRequest *req) { unsigned char index = req->wValue; unsigned char type = req->wValue >> 8; // unsigned char length = req->wLength; EP0tx.Index = 0; EP0tx.DataPid = 1; switch (type) { case DEVICE: #if DEBUG USBNDebug("DEVICE DESCRIPTOR\n\r"); #endif EP0tx.Size = DeviceDescriptor.bLength; EP0tx.Buf = (unsigned char*)(&DeviceDescriptor); // first get descriptor request is // always be answered with first 8 unsigned chars of dev descriptor //SendHex(req->wLength); if(req->wLength==0x08) req->wLength=0x40; if(req->wLength==0x40) EP0tx.Size = 8; break; case CONFIGURATION: #if DEBUG USBNDebug("CONFIGURATION DESCRIPTOR "); #endif // send complete tree EP0tx.Size =(unsigned short)req->wLength; EP0tx.Buf = (unsigned char*)&(FinalConfigurationArray[index][0]); break; case STRING: #if DEBUG USBNDebug("STRING DESCRIPTOR "); SendHex(index); USBNDebug("\r\n"); #endif if(index >0) { EP0tx.Buf = (unsigned char*)&(FinalStringArray[index][0]); EP0tx.Size = EP0tx.Buf[0]; } else { #if DEBUG USBNDebug("language descriptor"); #endif char lang[]= {0x04,0x03,0x09,0x04}; //EP0tx.Buf = &FinalStringArray[0][0]; //EP0tx.Size = EP0tx.Buf[0]; if(req->wLength==1) EP0tx.Size=1; else EP0tx.Size=4; EP0tx.Buf = (unsigned char*)lang; } break; } //if (EP0rx.Buf[7]==0) //if less than 256 req'd // if (EP0tx.Size > EP0rx.Buf[6]) EP0tx.Size = EP0rx.Buf[6]; _USBNTransmit(&EP0tx); }
/**************************************************************************** NAME aghfpMsgHandleLibMessage DESCRIPTION Handles AGHFP library messages and calls the relevant handler function. */ void aghfpMsgHandleLibMessage(MessageId id, Message message) { switch(id) { case AGHFP_INIT_CFM: { DEBUG_AGHFP(("AGHFP_INIT_CFM status = %u [0x%X]\n", ((AGHFP_INIT_CFM_T *)message)->status,(uint16)((AGHFP_INIT_CFM_T *)message)->aghfp)); handleAghfpInitCfm((AGHFP_INIT_CFM_T *)message); break; } case AGHFP_SLC_CONNECT_IND: { AGHFP_SLC_CONNECT_IND_T *ind = (AGHFP_SLC_CONNECT_IND_T *)message; SendEvent(EVT_SLC_CONNECT_IND,0); DEBUG_AGHFP(("AGHFP_SLC_CONNECT_IND aghfp=0x%X from: 0x%X 0x%X 0x%lX\n", (uint16)ind->aghfp, ind->bd_addr.nap, ind->bd_addr.uap, ind->bd_addr.lap)); handleAghfpSlcConnectInd(ind); break; } case AGHFP_SLC_CONNECT_CFM: { AGHFP_SLC_CONNECT_CFM_T *cfm = (AGHFP_SLC_CONNECT_CFM_T *)message; SendEvent(EVT_SLC_CONNECT_CFM,cfm->status); DEBUG_AGHFP(("AGHFP_SLC_CONNECT_CFM aghfp = 0x%X status = %u\n", (uint16)cfm->aghfp, cfm->status)); handleAghfpSlcConnectCfm(cfm); break; } case AGHFP_SLC_DISCONNECT_IND: { AGHFP_SLC_DISCONNECT_IND_T *ind = (AGHFP_SLC_DISCONNECT_IND_T *)message; SendEvent(EVT_SLC_DISCONNECT_IND,ind->status); DEBUG_AGHFP(("AGHFP_SLC_DISCONNECT_IND aghfp = 0x%X status = %d\n", (uint16)ind->aghfp, (uint16)ind->status)); handleAghfpSlcDisconnectInd(ind); break; } case AGHFP_CALL_MGR_CREATE_WAITING_RESPONSE_IND: { DEBUG_AGHFP(("AGHFP_CALL_MGR_CREATE_WAITING_RESPONSE_IND\n")); handleAghfpCallMgrCreateInd(((AGHFP_CALL_MGR_CREATE_WAITING_RESPONSE_IND_T *)message)->aghfp, ((AGHFP_CALL_MGR_CREATE_WAITING_RESPONSE_IND_T *)message)->audio_sink, AGHFP_CALL_MGR_CREATE_WAITING_RESPONSE_IND); break; } case AGHFP_CALL_MGR_CREATE_ALERTING_REMOTE_IND: { DEBUG_AGHFP(("AGHFP_CALL_MGR_CREATE_ALERTING_REMOTE_IND\n")); handleAghfpCallMgrCreateInd(((AGHFP_CALL_MGR_CREATE_ALERTING_REMOTE_IND_T *)message)->aghfp, ((AGHFP_CALL_MGR_CREATE_ALERTING_REMOTE_IND_T *)message)->audio_sink, AGHFP_CALL_MGR_CREATE_ALERTING_REMOTE_IND); break; } case AGHFP_CALL_MGR_CREATE_CFM: { DEBUG_AGHFP(("AGHFP_CALL_MGR_CREATE_CFM status = %u\n", ((AGHFP_CALL_MGR_CREATE_CFM_T *)message)->status)); handleAghfpCallMgrCreateCfm((AGHFP_CALL_MGR_CREATE_CFM_T *)message); break; } case AGHFP_CALL_MGR_TERMINATE_IND: { DEBUG_AGHFP(("AGHFP_CALL_MGR_TERMINATE_IND\n")); handleAghfpCallMgrTerminateInd((AGHFP_CALL_MGR_TERMINATE_IND_T *)message); break; } case AGHFP_AUDIO_CONNECT_IND: { SendEvent(EVT_AUDIO_CONNECT_IND,0); DEBUG_AGHFP(("AGHFP_AUDIO_CONNECT_IND\n")); handleAghfpAudioConnectInd((AGHFP_AUDIO_CONNECT_IND_T *)message); break; } case AGHFP_AUDIO_CONNECT_CFM: { SendEvent(EVT_AUDIO_CONNECT_CFM,((AGHFP_AUDIO_CONNECT_CFM_T *)message)->status); DEBUG_AGHFP(("AGHFP_AUDIO_CONNECT_CFM status = %u\n", ((AGHFP_AUDIO_CONNECT_CFM_T *)message)->status)); handleAghfpAudioConnectCfm((AGHFP_AUDIO_CONNECT_CFM_T *)message); break; } case AGHFP_AUDIO_DISCONNECT_IND: { SendEvent(EVT_AUDIO_DISCONNECT_IND,((AGHFP_AUDIO_DISCONNECT_IND_T *)message)->status); DEBUG_AGHFP(("AGHFP_AUDIO_DISCONNECT_IND\n")); handleAghfpAudioDisconnectInd((AGHFP_AUDIO_DISCONNECT_IND_T *)message); break; } case AGHFP_HS_CALL_ANSWER_IND: { DEBUG_AGHFP(("AGHFP_HS_CALL_ANSWER_IND\n")); MessageSend(&the_app->task,APP_VOIP_CALL_ACTIVE,0); break; } case AGHFP_HS_CALL_HANG_UP_IND: { DEBUG_AGHFP(("AGHFP_HS_CALL_HANG_UP_IND\n")); MessageSend(&the_app->task,APP_VOIP_CALL_INACTIVE,0); break; } case AGHFP_HS_AUDIO_REQUEST_IND: { DEBUG_AGHFP(("AGHFP_HS_AUDIO_REQUEST_IND\n")); if ( the_app->voip_call_active ) { } else { } break; } case AGHFP_ANSWER_IND: { DEBUG_AGHFP(("AGHFP_ANSWER_IND\n")); MessageSend(&the_app->task,APP_VOIP_CALL_ACTIVE,0); /* aghfpCallAnswer(aghfp_call_type_incoming);*/ break; } case AGHFP_CALL_HANG_UP_IND: { DEBUG_AGHFP(("AGHFP_CALL_HANG_UP_IND\n")); MessageSend(&the_app->task,APP_VOIP_CALL_INACTIVE,0); break; } case AGHFP_DIAL_IND: { DEBUG_AGHFP(("AGHFP_DIAL_IND\n")); MessageSend(&the_app->task,APP_VOIP_CALL_OUTGOING,0); break; } case AGHFP_MEMORY_DIAL_IND: { DEBUG_AGHFP(("AGHFP_MEMORY_DIAL_IND\n")); MessageSend(&the_app->task,APP_VOIP_CALL_OUTGOING,0); break; } case AGHFP_LAST_NUMBER_REDIAL_IND: { DEBUG_AGHFP(("AGHFP_LAST_NUMBER_REDIAL_IND\n")); MessageSend(&the_app->task,APP_VOIP_CALL_OUTGOING,0); break; } case AGHFP_CALLER_ID_SETUP_IND: { DEBUG_AGHFP(("AGHFP_CALLER_ID_SETUP_IND\n")); /* Ignore this message for now, OK sent by library */ DEBUG_AGHFP((" - ignored\n")); break; } case AGHFP_CALL_WAITING_SETUP_IND: { DEBUG_AGHFP(("AGHFP_CALL_WAITING_SETUP_IND\n")); /* Ignore this message for now, OK sent by library */ DEBUG_AGHFP((" - ignored\n")); break; } case AGHFP_CALL_HOLD_IND: { DEBUG_AGHFP(("AGHFP_CALL_HOLD_IND\n")); /* Ignore this message for now, OK sent by library */ DEBUG_AGHFP((" - ignored\n")); break; } case AGHFP_NREC_SETUP_IND: { DEBUG_AGHFP(("AGHFP_NREC_SETUP_IND\n")); /* noise reduction not supported so send error */ DEBUG_AGHFP((" - unsupported, send ERROR\n")); AghfpSendError(((AGHFP_NREC_SETUP_IND_T *)message)->aghfp); break; } case AGHFP_VOICE_RECOGNITION_SETUP_IND: { DEBUG_AGHFP(("AGHFP_VOICE_RECOGNITION_SETUP_IND\n")); /* Ensure voice recongition activation is disabled before setting up call */ /* on receipt of AGHFP_VOICE_RECOGNITION_ENABLE_CFM. */ AghfpVoiceRecognitionEnable(((AGHFP_VOICE_RECOGNITION_SETUP_IND_T *)message)->aghfp, FALSE); break; } case AGHFP_PHONE_NUMBER_REQUEST_IND: { DEBUG_AGHFP(("AGHFP_PHONE_NUMBER_REQUEST_IND\n")); /* Ignore this requiest, send ERROR */ DEBUG_AGHFP((" - ignored, send ERROR\n")); AghfpSendError(((AGHFP_PHONE_NUMBER_REQUEST_IND_T *)message)->aghfp); break; } case AGHFP_TRANSMIT_DTMF_CODE_IND: { DEBUG_AGHFP(("AGHFP_TRANSMIT_DTMF_CODE_IND\n")); /* Ignore this message for now, send OK even though we can't generate a DTMF tone */ DEBUG_AGHFP((" - ignored, send OK\n")); AghfpSendOk(((AGHFP_TRANSMIT_DTMF_CODE_IND_T *)message)->aghfp); break; } case AGHFP_SYNC_MICROPHONE_GAIN_IND: { DEBUG_AGHFP(("AGHFP_SYNC_MICROPHONE_GAIN_IND\n")); break; } case AGHFP_SYNC_SPEAKER_VOLUME_IND: { uint8 vol = ((AGHFP_SYNC_SPEAKER_VOLUME_IND_T*)message)->volume; DEBUG_AGHFP(("AGHFP_SYNC_SPEAKER_VOLUME_IND\n")); the_app->speaker_volume = vol; break; } case AGHFP_RESPONSE_HOLD_STATUS_REQUEST_IND: { DEBUG_AGHFP(("AGHFP_RESPONSE_HOLD_STATUS_IND\n")); /* Just send OK back since we do not support Response and Hold */ AghfpSendOk(((AGHFP_RESPONSE_HOLD_STATUS_REQUEST_IND_T *)message)->aghfp); break; } case AGHFP_SET_RESPONSE_HOLD_STATUS_IND: { DEBUG_AGHFP(("AGHFP_RESPONSE_HOLD_IND\n")); DEBUG_AGHFP((" - ignored, send OK\n")); /* Not in a hold state so don't need AghfpConfirmResponseHoldState so just send OK*/ AghfpSendOk(((AGHFP_SET_RESPONSE_HOLD_STATUS_IND_T *)message)->aghfp); break; } case AGHFP_SUBSCRIBER_NUMBER_IND: { DEBUG_AGHFP(("AGHFP_SUBSCRIBER_NUMBER_IND\n")); /* Ignore this message for now */ DEBUG_AGHFP((" - ignored\n")); AghfpSendSubscriberNumbersComplete(((AGHFP_SUBSCRIBER_NUMBER_IND_T *)message)->aghfp); break; } case AGHFP_SUBSCRIBER_NUMBER_CFM: { DEBUG_AGHFP(("AGHFP_SUBSCRIBER_NUMBER_CFM\n")); /* Ignore this message for now */ DEBUG_AGHFP((" - ignored\n")); break; } case AGHFP_CURRENT_CALLS_IND: { DEBUG_AGHFP(("AGHFP_CURRENT_CALLS_IND\n")); /* Current calls list not supported so just send ok */ DEBUG_AGHFP((" - no current calls so just OK\n")); AghfpSendOk(((AGHFP_CURRENT_CALLS_IND_T *)message)->aghfp); break; } case AGHFP_NETWORK_OPERATOR_IND: { char nwOP[4] = "VoIP"; DEBUG_AGHFP(("AGHFP_NETWORK_OPERATOR_IND\n")); /* we don't have a network operator so just send a generic string */ DEBUG_AGHFP((" - respond with operator name VoIP\n")); AghfpSendNetworkOperator(((AGHFP_NETWORK_OPERATOR_IND_T *)message)->aghfp, 0, 4, (uint8*)nwOP); break; } /* AGHFP function call confirms - for debug output */ case AGHFP_NETWORK_OPERATOR_CFM: { DEBUG_AGHFP(("AGHFP_NETWORK_OPERATOR_CFM\n")); break; } case AGHFP_SEND_SERVICE_INDICATOR_CFM: { DEBUG_AGHFP(("AGHFP_SEND_SERVICE_INDICATOR_CFM\n")); break; } case AGHFP_SEND_CALL_INDICATOR_CFM: { DEBUG_AGHFP(("AGHFP_SEND_CALL_INDICATOR_CFM\n")); break; } case AGHFP_SEND_CALL_SETUP_INDICATOR_CFM: { DEBUG_AGHFP(("AGHFP_CALL_SETUP_INDICATOR_CFM\n")); break; } case AGHFP_SEND_RING_ALERT_CFM: { DEBUG_AGHFP(("AGHFP_SEND_RING_ALERT_CFM\n")); break; } case AGHFP_SEND_CALLER_ID_CFM: { DEBUG_AGHFP(("AGHFP_SEND_CALLER_ID_CFM\n")); break; } case AGHFP_INBAND_RING_ENABLE_CFM: { DEBUG_AGHFP(("AGHFP_INBAND_RING_ENABLE\n")); break; } case AGHFP_SEND_CALL_WAITING_NOTIFICATION_CFM: { DEBUG_AGHFP(("AGHFP_SEND_CALL_WAITING_NOTIFICATION_CFM\n")); break; } case AGHFP_VOICE_RECOGNITION_ENABLE_CFM: { DEBUG_AGHFP(("AGHFP_VOICE_RECOGNITION_ENABLE_CFM\n")); break; } case AGHFP_SEND_PHONE_NUMBER_FOR_VOICE_TAG_CFM: { DEBUG_AGHFP(("AGHFP_SEND_PHONE_NUMBER_FOR_VOICE_TAG_CFM\n")); break; } case AGHFP_SET_REMOTE_MICROPHONE_GAIN_CFM: { DEBUG_AGHFP(("AGHFP_SET_REMOTE_MICROPHONE_GAIN_CFM\n")); break; } case AGHFP_SET_REMOTE_SPEAKER_VOLUME_CFM: { DEBUG_AGHFP(("AGHFP_SET_REMOTE_SPEAKER_VOLUME_CFM\n")); break; } case AGHFP_USER_DATA_CFM: { DEBUG_AGHFP(("AGHFP_USER_DATA_CFM status=%d\n", ((AGHFP_USER_DATA_CFM_T*)message)->status)); break; } case AGHFP_SEND_ERROR_CFM: { DEBUG_AGHFP(("AGHFP_SEND_ERROR_CFM status=%d\n", ((AGHFP_SEND_ERROR_CFM_T*)message)->status)); break; } case AGHFP_SET_SERVICE_STATE_CFM: { DEBUG_AGHFP(("AGHFP_SET_SERVICE_STATE_CFM\n")); break; } case AGHFP_READ_MESSAGE_IND: { DEBUG_AGHFP(("AGHFP_READ_MESSAGE_IND\n")); AghfpSendMessageBody( ((AGHFP_READ_MESSAGE_IND_T*)message)->aghfp,the_app->message_sender,the_app->message_body); break; } case AGHFP_NEW_MESSAGE_IND: { DEBUG_AGHFP(("AGHFP_READ_MESSAGE_IND\n")); SendEvent(EVT_SMS_READY,0); break; } case AGHFP_SEND_MESSAGE_IND: { DEBUG_AGHFP(("AGHFP_SEND_MESSAGE_IND\n")); SendData((uint8*)"\r\n+SMR=",7); SendData(((AGHFP_SEND_MESSAGE_IND_T*)message)->number,((AGHFP_SEND_MESSAGE_IND_T*)message)->size_number); the_app->waiting_msg = TRUE; MessageCancelAll(&the_app->task,APP_MSG_TIMEOUT); MessageSendLater(&the_app->task,APP_MSG_TIMEOUT,0,D_SEC(5)); break; } case AGHFP_UNRECOGNISED_AT_CMD_IND: { #ifdef ENABLE_DEBUGxx uint16 i,len = ((AGHFP_UNRECOGNISED_AT_CMD_IND_T*)message)->size_data; uint8 *ptr = ((AGHFP_UNRECOGNISED_AT_CMD_IND_T*)message)->data; DEBUG_AGHFP(("AGHFP_UNRECOGNISED_AT_CMD_IND\n")); for(i=0;i<len;i++) { DEBUG_AGHFP(("[%c] %x\n",ptr[i],ptr[i])); } #endif if(the_app->waiting_msg) { MessageCancelAll(&the_app->task,APP_MSG_TIMEOUT); the_app->waiting_msg = FALSE; AghfpSendMessageAck(((AGHFP_UNRECOGNISED_AT_CMD_IND_T *)message)->aghfp); SendData((uint8*)",",1); SendHex(((AGHFP_UNRECOGNISED_AT_CMD_IND_T*)message)->data,((AGHFP_UNRECOGNISED_AT_CMD_IND_T*)message)->size_data); SendData((uint8*)"\r\n",2); } else AghfpSendError(((AGHFP_UNRECOGNISED_AT_CMD_IND_T *)message)->aghfp); break; } case AGHFP_CSR_SUPPORTED_FEATURES_IND: { DEBUG_AGHFP(("AGHFP_CSR_SUPPORTED_FEATURES_IND\n")); break; } default: { DEBUG_AGHFP(("Unhandled AGHFP message 0x%X\n", (uint16)id)); break; } } }