public void ATTClientGroupFoundEvent(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { String log = String.Format("ble_evt_attclient_group_found: connection={0}, start={1}, end={2}, uuid=[ {3}]" + Environment.NewLine, e.connection, e.start, e.end, ByteArrayToHexString(e.uuid) ); //Console.Write(log); //ThreadSafeDelegate(delegate { txtLog.AppendText(log); }); if (debug) { SetLogText(log); } // found "service" attribute groups (UUID=0x2800), check for heart rate measurement service if (e.uuid.SequenceEqual(new Byte[] { 0x0D, 0x18 })) { //ThreadSafeDelegate(delegate { txtLog.AppendText(String.Format("Found attribute group for service w/UUID=0x180D: start={0}, end=%d", e.start, e.end) + Environment.NewLine); }); String logText = String.Format("Found attribute group for service w/UUID=0x180D: start={0}, end=%d", e.start, e.end) + Environment.NewLine; if (debug) { SetLogText(logText); } att_handlesearch_start = e.start; att_handlesearch_end = e.end; } }
/// <summary> /// Information (uuid) about serv. found, have to determine we know it (Serv. List). /// </summary> /// <param name="sender"></param> /// <param name="e">GroupFoundEventArgs</param> public void ATTClientGroupFoundEvent(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { String log = String.Format("group_found: connection={0}, start={1}, end={2}, uuid=[ {3}]" + Environment.NewLine, e.connection, e.start, e.end, ByteArrayToHexString(e.uuid) ); Console.Write(log); ThreadSafeDelegate(delegate { txtLog.AppendText(log); }); // found "service" attribute groups check for sensorplattform and debug service if (e.uuid.SequenceEqual(new Byte[] { 0x1b, 0xc5, 0xd5, 0xa5, 0x02, 0x00, 0x37, 0xa9, 0xe3, 0x11, 0xde, 0x88, 0x04, 0x00, 0x7e, 0x10 })) // || e.uuid.SequenceEqual(new Byte[] { 0x1b, 0xc5, 0xd5, 0xa5, 0x02, 0x00, 0x37, 0xa9, 0xe3, 0x11, 0xde, 0x88, 0x01, 0x01, 0x7e, 0x10 })) { ThreadSafeDelegate(delegate { txtLog.AppendText(String.Format("attribute group found service {0} start={1}, end={2}", e.uuid, e.start, e.end) + Environment.NewLine); }); att_handlesearch_start = e.start; att_handlesearch_end = e.end; // app_state = STATE_SEARCH_PLATTFORM_SERVICE; } else { ThreadSafeDelegate(delegate { txtLog.AppendText(String.Format("!!! NO group found") + Environment.NewLine); }); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void BLEATTClientGroupFoundEvent(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { Application.Current.Dispatcher.Invoke(delegate { MessageWriter.LogWrite("ble_evt_att_client_group_found: ", string.Format("connection={0}, start={1}, end={2}, uuid={3}", e.connection, e.start, e.end, BitConverter.ToString(e.uuid))); BLEPeripheral peripheral; if (!connectedDevices.TryGetConnection(e.connection, out peripheral)) { MessageWriter.LogWrite("Unable to find connection " + e.connection); return; } Service s = new Service(); s.Handle = e.start; s.GroupEnd = e.end; s.GroupUUID = e.uuid; s.Declaration = peripheral.Attributes[e.start]; s.Description = Bluetooth.Parser.Lookup(e.uuid); if (s.Description == null) { s.Description = BitConverter.ToString(s.UUID); } if (peripheral.TryAddService(s)) { peripheral.PopulateService(s); } }); }
//------------------------------------------------------------------------------------------------------------- // Event handler for the ATTClientGroupFoundEvent. // Here, a service "group" has been found, and that group must be texted to determine if it is // the specific service group we are interested in. public void ATTClientGroupFoundEvent(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { String log = String.Format("ble_evt_attclient_group_found: connection={0}, start={1}, end={2}, uuid=[ {3}]" + Environment.NewLine, e.connection, e.start, e.end, ByteArrayToHexString(e.uuid) ); Console.Write(log); ThreadSafeDelegate(delegate { txtLog.AppendText(log); }); // Since we were searching for "service" attribute groups (UUID=0x2800), we must have found // a "service" attribute groups (UUID=0x2800). // Check the returned e.uuid list for the Heart Rate Measurement service. // Ref: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.service.heart_rate.xml // This uses an "extension" method defined in System.Linq.IEnumerable. if (e.uuid.SequenceEqual(new Byte[] { 0x0D, 0x18 })) // Little-endian { // Fount the Heart Rate service, so save the attribute group start and end "indices'. ThreadSafeDelegate(delegate { txtLog.AppendText(String.Format("Found attribute group for service w/UUID=0x180D: start={0}, end=%d", e.start, e.end) + Environment.NewLine); }); att_handlesearch_start = e.start; // Start of attribute group att_handlesearch_end = e.end; // End of attribute group } }
//This event is produced when an attributed group(a service) is found. Typically this event is produced after Read by Group Type command. //Data Feild: // [4] = uint8, connection; Connection handle; // [5~6] = uint16,start; Starting handle; // [7~8] = uint16,end; Ending handle; 'end' is a reserved word and in BGScrpit so 'end' conn't be used as such. // [9..] = uint8array, uuid; UUID os a service; Length is 0 if no service are found. public void EventGroupFound(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { if (!c_BleDev.IsSrvGerenicAccess(e.uuid) && !c_BleDev.IsSrvGenericAttribute(e.uuid)) { c_BleDev.PrimSrvAdd(e.uuid, e.start, e.end); } }
private void ATTClientGroupFoundEvent(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { String log = String.Format("ble_evt_attclient_group_found: connection={0}, start={1}, end={2}, uuid=[ {3}]" + Environment.NewLine, e.connection, e.start, e.end, ByteArrayToHexString(e.uuid) ); Console.WriteLine("Sipp9X: " + log); if (e.uuid.SequenceEqual(serviceUuid)) { Console.WriteLine(String.Format("Found attribute group for service w/UUID={2}: start={0}, end={1}", e.start, e.end, e.uuid) + Environment.NewLine); SetHandleRange(e.start, e.end); } }
public void ATTClientGroupFoundEvent(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { String log = String.Format("ble_evt_attclient_group_found: connection={0}, start={1}, end={2}, uuid=[ {3}]" + Environment.NewLine, e.connection, e.start, e.end, ByteArrayToHexString(e.uuid) ); Console.Write("Sipp3XII: " + log); // found "service" attribute groups (UUID=0xfff0), check for heart rate measurement service if (e.uuid.SequenceEqual(new Byte[] { 0xf0, 0xff })) { Console.WriteLine(String.Format("Found attribute group for service w/UUID=0xfff0: start={0}, end={1}", e.start, e.end) + Environment.NewLine); SetHandleRange(e.start, e.end); } }
public void ATTClientGroupFoundEvent(object sender, Bluegiga.BLE.Events.ATTClient.GroupFoundEventArgs e) { String log = String.Format("ble_evt_attclient_group_found: connection={0}, start={1}, end={2}, uuid=[ {3}]" + Environment.NewLine, e.connection, e.start, e.end, ByteArrayToHexString(e.uuid) ); Console.Write(log); ThreadSafeDelegate(delegate { txtLog.AppendText(log); }); if (e.uuid.SequenceEqual((new Byte[] { 0x19, 0xb1, 0x00, 0x10, 0xE8, 0xF2, 0x53, 0x7E, 0x4F, 0x6C, 0xD1, 0x04, 0x76, 0x8A, 0x01, 0x16 }).Reverse())) { ThreadSafeDelegate(delegate { txtLog.AppendText(String.Format("Found attribute group for service w/UUID=0x180D: start={0}, end=%d", e.start, e.end) + Environment.NewLine); }); att_handlesearch_start = e.start; att_handlesearch_end = e.end; } }