iOS Disconnect issue
I'm a mobile application developer and i'm trying to trigger an action on my iOS application using V.Button. But i have a problem with using it, Once i connected to bluetooth central it gets disconnected in a few seconds. Could you please help me out?
-
Official comment
After connecting, you need to write/send the verification key to V.BTTN (within 30s). If not, V.BTTN will disconnect from the phone. See sections 10 and 7e of the V.BTTN Developer’s Guide.
Here’s a code snippet showing how to write the verification key:
#define BLE_KEYPRESS_SERVICE_UUID @"fffffff0-00f7-4000-b000-000000000000"//Vsn Gatt service
#define BLE_KEYPRESS_FALLDETECT_NORMAL @"fffffff5-00f7-4000-b000-000000000000"//V.BTTN Verification Characteristic
NSData *data = [NSData dataWithBytes:(Byte[]){0x80,0xBE,0xF5,0xAC,0xFF} length:5];
[self writeValue:BLE_KEYPRESS_SERVICE_UUID characteristicUUID:BLE_KEYPRESS_FALLDETECT_NORMAL p:p data:data];
Comment actions -
Thank you very much for the response. I have successfully connected the V-Button and could trigger an action by pressing button. However now i face a new problem, Which is once i trigger the action(By long press of the button 2-10 secs) red LED keeps flashing after one long beep and won't stop. Do i have to acknowledge the module after receiving button action? If yes, how can i do so?
-
The continuous flashing indicates the button is in urgent alert mode. In order to clear the alert you need to do the following
Acknowledge the urgent alert by writing 0x01 to characteristic 0xFFFFFFF3-00F7-4000-B000-000000000000. V.BTTN will then flash Red-Green. The phone UI can then indicate to the user that the button pressed has been received/acknowledged.
#define BLE_KEYPRESS_URGENT_ALERT_ACK @"fffffff3-00f7-4000-b000-000000000000”
char data = 0x01;
NSData *d = [[NSData alloc] initWithBytes:&data length:1];
[self writeValue:BLE_KEYPRESS_SERVICE_UUID characteristicUUID: BLE_KEYPRESS_URGENT_ALERT_ACK p:p data:d];
After acknowledging the alert, app can cancel/clear the alternating blinking Red/Green LED by writing 0x00 to characteristic 0xFFFFFFF3-00F7-4000-B000-000000000000.
char data = 0x00;
NSData *d = [[NSData alloc] initWithBytes:&data length:1];
[self writeValue:BLE_KEYPRESS_SERVICE_UUID characteristicUUID: BLE_KEYPRESS_URGENT_ALERT_ACK p:p data:d];
Regarding “Enable/Disable Notification”, CCC (2902) has read/write permission. It is implicitly written to when you set the notification on/off. Note: if you had notification enabled, then your app would have received a notification value 0x03 when you long press (2-10s) the button.
Please sign in to leave a comment.
Comments
3 comments