Sure you can. If the device will be custom made and you know its characteristics
Code below (TRANSFER_SERVICE_UUID - GUID of your device):
_centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
// You should test all scenarios
if (central.state != CBCentralManagerStatePoweredOn) {
[self stop];
return;
}
if (central.state == CBCentralManagerStatePoweredOn) {
// Scan for devices
[_centralManager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:TRANSFER_SERVICE_UUID]] options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];
NSLog(@"Scanning started");
if(_delegate)
{
if([_delegate respondsToSelector:@selector(CB_changedStatus:message:)])
{
[_delegate CB_changedStatus:CBManagerMessage_ScanningStarted message:@"Scanning started"];
}
}
}
}
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {
NSLog(@"Discovered %@ at %@", peripheral.name, RSSI);
if (_discoveredPeripheral != peripheral) {
// Save a local copy of the peripheral, so CoreBluetooth doesn't get rid of it
_discoveredPeripheral = peripheral;
// And connect
NSLog(@"Connecting to peripheral %@", peripheral);
if(_delegate)
{
if([_delegate respondsToSelector:@selector(CB_changedStatus:message:)])
{
[_delegate CB_changedStatus:CBManagerMessage_ConnectingToPeripheral message:[NSString stringWithFormat:@"Connecting to peripheral %@", peripheral]];
}
}
[_centralManager connectPeripheral:peripheral options:nil];
}
}