err_t OutEcho(struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, uint port, uchar broadcast) { if (broadcast == 0) fBroadcastSelect = true; uint wSfx = 0; if (p->len > 1) { uint2 w2 = PopSfx(p); if (InvalidInt2(w2)) return w2.err; wSfx = w2.w; } InitPush(); PushChar('A'); PushMAC(mbMAC, 6); PushChar('/'); PushStringZ("000001001"); // TODO "000001001" PushChar('/'); PushChar('N'); PushChar('*'); HardwareError() ? PushChar('E') : PushChar('*'); PushChar('M'); PushChar('*'); PushChar('/'); EthernetToSerialBufferOverflow() ? PushChar('E') : PushChar('*'); SerialToEthernetBufferOverflow() ? PushChar('S') : PushChar('*'); PushChar('/'); PushStringZ(szOwnerName); PushChar('/'); PushStringZ(szDeviceName); PushChar('/'); PushCharDec(UART_COUNT); if (p->len > 1) { PushSfx(wSfx); } return Out(pcb,p,addr,port,broadcast); }
void LocalDeviceImpl::HandleUnexpectedEvent(struct hci_event_header* event) { // Events here might have not been initated by us // TODO: ML mark as handled pass a reply by parameter and reply in common switch (event->ecode) { case HCI_EVENT_HARDWARE_ERROR: HardwareError( JumpEventHeader<struct hci_ev_hardware_error>(event)); break; case HCI_EVENT_CONN_REQUEST: ConnectionRequest( JumpEventHeader<struct hci_ev_conn_request>(event), NULL); break; case HCI_EVENT_NUM_COMP_PKTS: NumberOfCompletedPackets( JumpEventHeader<struct hci_ev_num_comp_pkts>(event)); break; case HCI_EVENT_DISCONNECTION_COMPLETE: // should belong to a request? can be sporadic or initiated by us? DisconnectionComplete( JumpEventHeader <struct hci_ev_disconnection_complete_reply>(event), NULL); break; case HCI_EVENT_PIN_CODE_REQ: PinCodeRequest( JumpEventHeader<struct hci_ev_pin_code_req>(event), NULL); break; default: // TODO: feedback unexpected not handled break; } }