| 209 | } |
| 210 | |
| 211 | bool initBLEServer() { |
| 212 | uint64_t chipid = ESP.getEfuseMac(); |
| 213 | String blename = "Bruce-" + String((uint8_t)(chipid >> 32), HEX); |
| 214 | |
| 215 | BLEDevice::init(blename.c_str()); |
| 216 | // BLEDevice::setPower(ESP_PWR_LVL_N12); |
| 217 | pServer = BLEDevice::createServer(); |
| 218 | |
| 219 | pServer->setCallbacks(new MyServerCallbacks()); |
| 220 | pService = pServer->createService(SERVICE_UUID); |
| 221 | pTxCharacteristic = pService->createCharacteristic(CHARACTERISTIC_RX_UUID, NIMBLE_PROPERTY::NOTIFY); |
| 222 | |
| 223 | pTxCharacteristic->addDescriptor(new NimBLE2904()); |
| 224 | BLECharacteristic *pRxCharacteristic = pService->createCharacteristic( |
| 225 | CHARACTERISTIC_TX_UUID, NIMBLE_PROPERTY::WRITE | NIMBLE_PROPERTY::WRITE_NR |
| 226 | ); |
| 227 | pRxCharacteristic->setCallbacks(new MyCallbacks()); |
| 228 | |
| 229 | return true; |
| 230 | } |
| 231 | |
| 232 | void disPlayBLESend() { |
| 233 | uint8_t senddata[2] = {0}; |