OK so once you get your device UUID you need to:
Code: Select all
on mergBLEDidDiscoverPeripheral pPeripheral, pName, pRSSI
mergBLEConnectPeripheral pPeripheral
end mergBLEDidDiscoverPeripheral
on mergBLEDidConnectPeripheral pPeripheral
mergBLEPeripheralDiscoverServices pPeripheral
end mergBLEDidConnectPeripheral
on mergBLEPeripheralDidDiscoverServices pPeripheral, pServices, pError
if pError is not empty then
answer "Error discovering services:" & cr & pError
else
repeat for each line tService in pServices
mergBLEPeripheralDiscoverCharacteristicsForService pPeripheral, tService
end repeat
end if
end mergBLEPeripheralDidDiscoverServices
on mergBLEPeripheralDidDiscoverCharacteristicsForService pPeripheral, pService, pCharacteristics, pError
if pError is not empty then
answer "Error discovering characteristics for "&sPeripheralA[pPeripheral]["name"] & cr & pError
else
repeat for each line tCharacteristic in pCharacteristics
switch
case pService begins with "FFF0" and tCharacteristic begins with "FFF1"
-- password
mergBLEPeripheralWriteValueForCharacteristic pPeripheral, pService, tCharacteristic, "fff"
break
-- other characteristics from docs
end switch
end repeat
end if
end mergBLEPeripheralDidDiscoverCharacteristicsForService
Note that the docs are a bit funny for the password. It says 2 bytes but then 0x666666 which is 3 bytes converts to "fff". Anyway the above should show you how to write to a characteristic. If there's a problem with it I'd recommend logging all the services and characteristics found so you can see what's going on.