Skip to content

tahaHichri/BLEiOSScanner

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

BLEiOSScanner

Connecting to a Bluetooth 4.0 LE can be tricky especially on iOS where the real address of devices is hidden behind the generated UUID. This class will help you:

  • discover advertising Bluetooth LE peripherals ( servers ).
  • Connect to a specific device.
  • list available services.
  • read each service characteristics.
  • read available descritors.
  • list allowed permission for read/write.

How to use it

1 - Move class files into your project ( you can use drag-n-drop ) using xCode.

2 - Include BluetoothLEManager class in your ViewController

#import "BlueToothLEManager.h"

3 - declare BluetoothLEManager and intialize it

@interface ViewController ()
@property (strong) BlueToothLEManager *bluetoothManager;
@end



- (void)viewDidLoad {
    [super viewDidLoad];
  // code
    self.bluetoothManager = [[BlueToothLEManager alloc] init];
}

NOTE: You can use TableView to display the list of devices. the discovered devices are stored in foundDevices Don't forget to set the tableView delegate and source.
example:

- (void)viewDidLoad {
    [super viewDidLoad];
    self.table.delegate = self;
    self.table.dataSource = self;
    self.bluetoothManager = [[BlueToothLEManager alloc] init];
}

Excerpt of console log (the remaining has been deliberately omitted)

preview of console

  Copyright 2016 hishri taha.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

A simple class for discovering, connecting and reading Bluetooth Low Energy devices for iOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published