arduino / ArduinoCore-primo

Arduino core for nrf52 cpu
38 stars 35 forks source link

Problem when using BLECharCharacteristic.setValue #55

Closed ttn115 closed 6 years ago

ttn115 commented 6 years ago

Hi, I test the ble functions on arduino primo with library ver 1.0.1 download from arduino IDE 1.8.2. https://github.com/sandeepmistry/arduino-BLEPeripheral

i get an error below // writeback_status=ReadCharacteristic.setValue(BLECentral& central,(unsigned char )time, 2); ^ exit status 1 expected primary-expression before '&' token // no matching function for call to 'BLECharCharacteristic::setValue(unsigned char, int)' when i code writeback_status=ReadCharacteristic.setValue((unsigned char *)time, 2);

i try to trace the code define below, but still have no idea fixing my problem ` //bool BLECharacteristic::setValue(const char value) { // return this->setValue((const unsigned char )value, strlen(value)); //}

//void BLECharacteristic::setValue(BLECentral& central, const unsigned char value[], unsigned char length) { // this->setValue(value, length); // // this->_written = true; // // BLECharacteristicEventHandler eventHandler = this->_eventHandlers[BLEWritten]; // if (eventHandler) { // eventHandler(central, *this); // } //}

//void BLECharacteristic::setValue(BLENode& node, const unsigned char value[], unsigned char length) { // this->setValue(value, length); // // this->_written = true; // // BleCharacteristicEventHandler eventHandler = this->_eventHandl[BLEWritten]; // if (eventHandler) { // eventHandler(node, *this); // } //}`

Question .what is BLECentral& central means in this function?

Could someone answers my questions and fix my problem..THX~

ttn115 commented 6 years ago

after all i succeed with the code below

unsigned char v_time[] = {50,56,48,49,56,48};i unsigned char length = 6; writeback_status=ReadCharacteristic.setValue(v_time,length); which BLECharacteristic ReadCharacteristic = BLECharCharacteristic("XXXXXXXXXXXXXXXXXXXXX", BLERead | BLEWrite);