troystribling / BlueCap

iOS Bluetooth LE framework
MIT License
714 stars 114 forks source link

write command not return expected result #66

Closed mdsalah990 closed 7 years ago

mdsalah990 commented 7 years ago

i tried to read temperature from foramed devices with command 0x26 i can pairing and read info (name ,version , manufacturer) but i cann't write command 0x26 to read result

// Scaning 4 seconds for peripherals [[LGCentralManager sharedInstance] scanForPeripheralsByInterval:10 completion:^(NSArray peripherals) { // If we found any peripherals sending to test for (LGPeripheral per in peripherals) { if ([per.UUIDString isEqualToString:@"2FF2DAFC-D4D5-4929-8E80-4CA23C56EEF2"]) {

     const uint16_t bytes[] = {0x26};
     NSData *data = [NSData dataWithBytes:bytes length:sizeof(bytes)];

         [LGUtils writeData:data
                charactUUID:@"00001524-1212-efde-1523-785feabcd123"
                serviceUUID:@"00001523-1212-efde-1523-785feabcd123"
                 peripheral:per completion:^(NSError *error) {
                     NSLog(@"Error : %@", error);

                     [LGUtils readDataFromCharactUUID:@"00001524-1212-efde-1523-785feabcd123"
                                          serviceUUID:@"00001523-1212-efde-1523-785feabcd123"
                                           peripheral:per
                                           completion:^(NSData *data, NSError *error) {
                                               NSLog(@"Data : %s Error : %@", (char *)[data bytes], error);
                                           }];
                 }];

 }
     NSLog(@"name:%@ UUID:%@",per.name,per.UUIDString);
 }

}];

troystribling commented 7 years ago

I do not understand what you are asking. Your example is written in Obj-C and does not use the BlueCap framework.