/* #ifdef Q_OS_SYMBIAN // used only to hide status pane #include <eikspane.h> #include <aknappui.h> #include <avkon.rsg> #include <EIKENV.H> #include <coemain.h> #endif */ QuteMessenger::QuteMessenger(QWidget *parent) : QMainWindow(parent), previousSelectedTab(0), rfcommServer(NULL), devDisc(NULL), serviceDisc( NULL), obexClient(NULL), dialog(NULL), obexDialog(NULL) { /* #ifdef Q_OS_SYMBIAN CEikStatusPane* statusPane = STATIC_CAST( CAknAppUi*, CEikonEnv::Static()->EikAppUi())->StatusPane(); statusPane->MakeVisible(EFalse); #endif*/ int deviceYourClass = qRegisterMetaType<QBtDevice> ("QBtDevice"); int addressYourClass = qRegisterMetaType<QBtAddress> ("QBtAddress"); ui.setupUi(this); //dialog = new QProgressDialog(ui.deviceListWidget); CreateActions(); SetupMenu(true); //setup devSearchButton signal handler connect(ui.devSearchButton, SIGNAL(clicked()), this, SLOT(startDeviceDiscovery())); connect(ui.deviceListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(deviceSelected(QListWidgetItem*))); connect(ui.deviceListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(deviceSelected(QListWidgetItem*))); connect(ui.tabWidget, SIGNAL( tabCloseRequested ( int )), this, SLOT(closeCurrentTab())); //connect(ui.) InitializeBluetooth(); this->setWindowFlags(Qt::WindowSoftkeysVisibleHint); this->showFullScreen(); // QRect screenSize = QApplication::desktop()->screenGeometry(); // this->setGeometry(25,25, screenSize.width()/2, screenSize.height()/2); }
//***************************************************************************** // // The following is the Main Application Thread. It will Initialize the // Bluetooth Stack and all used profiles. // //***************************************************************************** static void MainApp(void *pThreadParameter) { int iPressCount; int iTick; int iVolume; int iRetVal; tDeviceInfo sDeviceInfo; BTPS_Initialization_t sBTPSInitialization; // // Set the callback function the stack can use for printing to the // console. // #ifdef DEBUG_ENABLED sBTPSInitialization.MessageOutputCallback = MessageOutputCallback; #else sBTPSInitialization.MessageOutputCallback = NULL; #endif // // Initialize the Bluetooth stack, using no callback parameters (NULL). // iRetVal = InitializeBluetooth(BluetoothCallbackFunction, NULL, &sBTPSInitialization); // // Initialize the Graphics Module. // InitializeGraphics(ButtonPressCallback); // // Proceed with application if there was no Bluetooth init error. // if(!iRetVal) { // // Make the device Connectable and Discoverable and enabled Secured // Simple Pairing. // SetLocalDeviceMode(CONNECTABLE_MODE | DISCOVERABLE_MODE | PAIRABLE_SSP_MODE); // // Get information about our local device. // iRetVal = GetLocalDeviceInformation(&sDeviceInfo); if(!iRetVal) { // // Format the board address into a string, and display it on // the console. // BD_ADDRToStr(sDeviceInfo.ucBDAddr, g_cBoardAddress); Display(("Local BD_ADDR: %s\r\n", g_cBoardAddress)); // // Display additional info about the device to the console // Display(("HCI Version : %s\r\n", g_pcHCIVersionStrings[sDeviceInfo.ucHCIVersion])); Display(("Connectable : %s\r\n", ((sDeviceInfo.sMode & CONNECTABLE_MODE) ? "Yes" : "No"))); Display(("Discoverable : %s\r\n", ((sDeviceInfo.sMode & DISCOVERABLE_MODE) ? "Yes" : "No"))); if(sDeviceInfo.sMode & (PAIRABLE_NON_SSP_MODE | PAIRABLE_SSP_MODE)) { Display(("Pairable : Yes\r\n")); Display(("SSP Enabled : %s\r\n", ((sDeviceInfo.sMode & PAIRABLE_SSP_MODE) ? "Yes" : "No"))); } else { Display(("Pairable : No\r\n")); } // // Show message to user on the screen // UpdateStatusBox("Waiting for Connection..."); // // Bluetooth should be running now. Enter a forever loop to run // the user interface on the board screen display and process // button presses. // iTick = ONE_SEC_COUNT; iVolume = DEFAULT_POWERUP_VOLUME; iPressCount = 0; while(1) { // // Update the screen. // ProcessGraphics(); // // Wait 1/10 second. // BTPS_Delay(TENTH_SEC_COUNT); // // If one second has elapsed, toggle the LED // if(!(--iTick)) { iTick = ONE_SEC_COUNT; ToggleLED(LED_PIN); } // // Check to see if the User Switch was pressed. // if(UserSwitchPressed()) { // // Count the amount of time that the button has been // pressed. // iPressCount++; } // // Else the user switch is not pressed // else { // // If the button was just released, then adjust the volume. // Decrease the volume by 10% for each button press. At // zero, then reset it to 100%. // if(iPressCount) { iVolume = (iVolume == 0) ? 100 : iVolume - 10; // // Set the new volume, and display a message on the // console // SoundVolumeSet(iVolume); Display(("Press Count %d Volume %d\r\n", iPressCount, iVolume)); iPressCount = 0; } } } } } // // There was an error initializing Bluetooth // else { // // Print an error message to the console and show a message on // the screen // Display(("Bluetooth Failed to initialize: Error %d\r\n", iRetVal)); UpdateStatusBox("Failed to Initialize Bluetooth."); // // Enter a forever loop. Continue to update the screen, and rapidly // blink the LED as an indication of the error state. // while(1) { ProcessGraphics(); BTPS_Delay(500); ToggleLED(LED_PIN); } } }