int main(int argc, char **argv) { t_bdaddr iutBdAddr; if (argc < 2) { fprintf(stderr, "usage: tester_l2cap <test_num>"); exit(-1); } test_num=atoi(argv[1]); linux_sys_mode=0; fprintf(stderr, "L2CAP TESTER: TEST No. %d", test_num); sys_init(linux_sys_mode); fprintf(stderr,"L2CAP TESTER: starting the stack\n"); MGR_Init(0); l2_init_lower_tester(); MGR_ParseHexBDAddress(IUT_BDADDR, &iutBdAddr); l2_lower_tester(test_num, iutBdAddr); while(1); }
int app_main(void) { int status; prh_printf("\n\n\nParthus Technologies Headset Profile Headset Application\n\n"); start_host(); do { status = MGR_Init(0); if(status == BT_RETRY) { /* Delay for 100 ms */ OS_DELAY(100); } }while(status == BT_RETRY); if (status!=BT_NOERROR) { prh_printf("Host stack initialisation error (0x%02X)\n",status); return 1; } status=HS_Init(); if(status) { prh_printf(" Headset initialisation error\n"); return 0; } MMI_Main(); return 0; }
int main(int argc, char **argv) { int a; #if !WIN_DB linux_sys_mode=0; sys_init(linux_sys_mode); #else // startHost(); #endif fprintf(stderr,"starting the stack\n"); /* prh_mgr_initStack(argc,argv); */ MGR_Init(0); MGR_SetSecurityMode(MGR_NOSECURITY, NULL); HCI_WriteScanEnable(3); /* MGR_SetConnectableMode(MGR_CONNECTABLE,test); a = MGR_SetDiscoverableMode(MGR_GENERALDISCOVERY,test); */ pDebugCheck(); Test_Data_Base_Setup(); pDebugCheck(); SDP_OpenSearch(); fprintf(stderr,"SDP server up and running.\n"); while(1) { #if WIN_DB Sleep(1000); #else pDebugSleep(1); #endif } }
int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "usage: iut_gap <test_num>"); exit(-1); } test_num=atoi(argv[1]); linux_sys_mode=0; fprintf(stderr, "GAP IUT: TEST No. %d", test_num); sys_init(linux_sys_mode); fprintf(stderr,"GAP IUT: starting the stack\n"); MGR_Init(0); (*gap_iut_conform_test[test_num-1])(); while(1); }
void BTapp_Sched(u_int32 num_interations) { int status; t_bdaddr address; char addressString[MGR_ADDRSTRLEN]; char selection[5]; int volumeSetting; if(initflag == 0) { status = MGR_Init(0); if (status==BT_NOERROR) status=HS_Init(); if (status==BT_NOERROR) { initflag = 1; MGR_RegisterPINHandler(pin_requestCallback); if (MMI_RetrieveGatewayAddress(&address)) { MGR_PrintBDAddress(address,addressString); prh_printf("Currently configured audio gateway device address is %s\n",addressString); } else { prh_printf("There is no currently configured audio gateway device address\n"); prh_printf("When an audio gateway has connected, select option 'r' \n"); prh_printf("to use this audio gateway for headset-originated connections.\n"); } prh_printf("\n\n"); } } else { if(printFlag) { if (scoState==DISCONNECTED && MMI_RetrieveGatewayAddress(&address)) prh_printf("\tPress Key1 to create an audio link to the audio gateway\n"); if (scoState==CONNECTED) prh_printf("\tPress Key1 to disconnect the audio link to the audio gateway\n"); if (aclState==CONNECTED) prh_printf("\tPress Key2 to configure the audio gateway device address\n"); if (VOLCTRLENABLED) { prh_printf("\tPress Key3 to change the local speaker volume\n"); prh_printf("\tPress Key4 to change the local microphone volume\n"); } prh_printf("\n\n"); } cmdLocallyIntiated=0; selection[0] = prh_getch(); cmdLocallyIntiated=1; switch (selection[0]) { case 1: /* was originally <Enter> */ if (scoState==DISCONNECTED) prh_printf("Connecting audio connection...\n"); else prh_printf("Disconnecting audio connection...\n"); status=HS_HeadsetButtonPressed(); if(status) { prh_printf("Headset Button press was unsuccessful\n"); } break; case 2: MMI_StoreGatewayAddress(&gatewayBDAddress); MGR_PrintBDAddress(gatewayBDAddress,addressString); prh_printf("Audio Gateway address %s stored.\n",addressString); break; case 3: if (!VOLCTRLENABLED) break; prh_printf("Enter new headset speaker setting (current=%d) (0-15): ",spkrVolSetting); volumeSetting = prh_getval(); prh_printf("\n"); if (volumeSetting>0 && volumeSetting<16) { MMI_SpkrVolSet(volumeSetting); HS_SpkrVolChanged(volumeSetting); } prh_printf("\n"); break; case 4: if (!VOLCTRLENABLED) break; prh_printf("Enter new headset microphone setting (current=%d) (0-15): ",micVolSetting); volumeSetting = prh_getval(); prh_printf("\n"); if (volumeSetting>0 && volumeSetting<16) { MMI_MicVolSet(volumeSetting); HS_MicVolChanged(volumeSetting); } prh_printf("\n\n"); break; } } }
int main(int argc, char *argv[]) { int status; t_L2_PsmCallbacks callbackPointers; t_bdaddr remoteAddress; t_bdaddr deviceAddress; char deviceAddressString[MGR_ADDRSTRLEN]; printf("\nParthus Technologies Bluetooth Host Software\n"); printf("Example Program 3 - L2CAP Client Application\n\n"); /************ Seed the random number generator */ /* This uses the command line argument to seed the random number generator. If this is not done, (i.e. a numeric argument is not supplied) the random numbers generated may be the same on each run of the program */ if (argc>1) { srand(atoi(argv[argc-1])); } /************ Initialise the Host Stack */ do { status = MGR_Init(0); } while (status==BT_RETRY); if (status == BT_NOERROR) { /************ Retrieve the Local Device Address */ status = MGR_GetLocalBDAddress(&deviceAddress); if (status == BT_NOERROR) { MGR_PrintBDAddress(deviceAddress, deviceAddressString); printf("Local device address is %s\n", deviceAddressString); printf("\n"); } else { printf("Error retrieving device address - error code 0x%02X\n",status); } /************ Register the PSM */ memset(&callbackPointers, 0, sizeof(callbackPointers)); callbackPointers.connectionConfirmation = channelEventHandler; callbackPointers.configureIndication = channelEventHandler; callbackPointers.configureConfirmation = channelEventHandler; callbackPointers.disconnectionConfirmation = channelEventHandler; callbackPointers.dataIndication = recievedDataHandler; status = L2_RegisterPSM(EXAMPLE_PSM, &callbackPointers); MGR_ParseHexBDAddress(TARGET_ADDRESS, &remoteAddress); printf("Connecting to device %s on PSM 0x%04X...\n",TARGET_ADDRESS, EXAMPLE_PSM); status = L2_Connect(remoteAddress, EXAMPLE_PSM); /************ Loop until the disconnection has been completed */ while (!terminateProgram) ; L2_DeregisterPSM(EXAMPLE_PSM); MGR_Shutdown(0); } else { /************ Handle Stack Initialisation Failure */ printf("Error initialising bluetooth stack - error code 0x%02X", status); if (status == BT_HCITERROR) { printf("Check the connection to the bluetooth device\n"); } } printf("\nProgram exiting.\n"); return 0; }
/* * ======== WCD_Init ======== * Purpose: * Module initialization is done by SERVICES Init. */ bool WCD_Init(void) { bool fInit = true; bool fDRV, fDEV, fCOD, fSERVICES, fCHNL, fMSG, fIO; bool fMGR, fPROC, fNODE, fDISP, fNTFY, fSTRM, fRMM; #ifdef DEBUG /* runtime check of Device IOCtl array. */ u32 i; int cmdtable = ARRAY_SIZE(WCD_cmdTable); for (i = 1; i < cmdtable; i++) DBC_Assert(WCD_cmdTable[i - 1].dwIndex == i); #endif if (WCD_cRefs == 0) { /* initialize all SERVICES modules */ fSERVICES = SERVICES_Init(); /* initialize debugging module */ DBC_Assert(!WCD_debugMask.flags); GT_create(&WCD_debugMask, "CD"); /* CD for class driver */ /* initialize class driver and other modules */ fDRV = DRV_Init(); fMGR = MGR_Init(); fPROC = PROC_Init(); fNODE = NODE_Init(); fDISP = DISP_Init(); fNTFY = NTFY_Init(); fSTRM = STRM_Init(); fRMM = RMM_init(); fCHNL = CHNL_Init(); fMSG = MSG_Init(); fIO = IO_Init(); fDEV = DEV_Init(); fCOD = COD_Init(); fInit = fSERVICES && fDRV && fDEV && fCHNL && fCOD && fMSG && fIO; fInit = fInit && fMGR && fPROC && fRMM; if (!fInit) { if (fSERVICES) SERVICES_Exit(); if (fDRV) DRV_Exit(); if (fMGR) MGR_Exit(); if (fSTRM) STRM_Exit(); if (fPROC) PROC_Exit(); if (fNODE) NODE_Exit(); if (fDISP) DISP_Exit(); if (fNTFY) NTFY_Exit(); if (fCHNL) CHNL_Exit(); if (fMSG) MSG_Exit(); if (fIO) IO_Exit(); if (fDEV) DEV_Exit(); if (fCOD) COD_Exit(); if (fRMM) RMM_exit(); } } if (fInit) WCD_cRefs++; GT_1trace(WCD_debugMask, GT_5CLASS, "Entered WCD_Init, ref count: 0x%x\n", WCD_cRefs); return fInit; }