Closed facundosala closed 10 months ago
I want to use this library with a project that already has a ble connection. My following code:
void setupBLEServer() { // init BLE server BLEDevice::init("BLUE_AUTO"); BLEDevice::setMTU(256); //<<<< MTU SIZE pServer = BLEDevice::createServer(); pServer->setCallbacks(new MyServerCallback()); // Alert Display Service BLEService *pService = pServer->createService(ALERT_DISPLAY_SERVICE_UUID); // BLECharacteristic* pCharacteristic = pService->createCharacteristic(DISPLAY_MESSAGE_CHARACTERISTIC_UUID,BLECharacteristic::PROPERTY_WRITE); // pCharacteristic->setWriteProperty(true); BLECharacteristic *pCharacteristicText = new BLECharacteristic(DISPLAY_MESSAGE_CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_WRITE_NR); // Respuesta MTU=500 del client pCharacteristicText->setCallbacks(new DisplayCharacteristicCallback()); pService->addCharacteristic(pCharacteristicText); // Display Time Characteristic BLECharacteristic *pCharacteristicTime = new BLECharacteristic(DISPLAY_TIME_CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_WRITE_NR); pCharacteristicTime->setCallbacks(new TimeCharacteristicCallback()); pService->addCharacteristic(pCharacteristicTime); // Change Display Orientation BLECharacteristic *pCharacteristicDisplayOrientation = new BLECharacteristic(DISPLAY_DISPLAY_ORIENTATION_CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_WRITE_NR); pCharacteristicDisplayOrientation->setCallbacks(new DisplayOrientationCharacteristicCallback()); pService->addCharacteristic(pCharacteristicDisplayOrientation); pService->start(); BLEAdvertising *pAdvertising = pServer->getAdvertising(); // https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml pAdvertising->setAppearance(GENERIC_DISPLAY); // Icono Impresora pAdvertising->start(); }
I can't run both at the same time. How should I integrate it?
I want to use this library with a project that already has a ble connection. My following code:
I can't run both at the same time. How should I integrate it?