void eliza(void){ uint8_t i, dlci = btRfcommReserveDlci(RFCOMM_DLCI_NEED_EVEN); int f; if(!dlci) dbgPrintf("ELIZA: failed to allocate DLCI\n"); else{ //change descriptor to be valid... for(i = 0, f = -1; i < sizeof(sdpDescrEliza); i++){ if(sdpDescrEliza[i] == MAGIX){ if(f == -1) f = i; else break; } } if(i != sizeof(sdpDescrEliza) || f == -1){ dbgPrintf("ELIZA: failed to find a single marker in descriptor\n"); btRfcommReleaseDlci(dlci); return; } sdpDescrEliza[f] = dlci >> 1; btRfcommRegisterPort(dlci, elzPortOpen, elzPortClose, elzPortRx); btSdpServiceDescriptorAdd(sdpDescrEliza, sizeof(sdpDescrEliza)); } }
void btRfcommReleaseDlci_ADK(uint8_t dlci){ btRfcommReleaseDlci(dlci); }