CocoaPods trunk is moving to be read-only. Read more on the blog, there are 16 months to go.

WIBLELib 0.0.10

WIBLELib 0.0.10

Maintained by CS KIM.



WIBLELib 0.0.10

  • By
  • cskim

Walinsights - Offline Customer Analytics

Walinsights analyzes customer behavior through outside traffic, store visits and returns through automated solution.

Platform Languages Commercial License

Overview

This BLE SDK providing a simple API set that gives third party Apps ability to get notified from registered ZOYI Squares (ZOYI Router device).

Prerequisite

  • iOS 8.0 or above

How to use it

Simple Flow Graph

     +-------------------------------+      
     |                               |      
     |  Get squares' MAC addresses.  |      
     |                               |      
     +---------------+---------------+      
                     |                      
                     |                      
                     |                      
    +----------------v----------------+     
    |                                 |     
    | BleManager start scan with      |     
    | these mac addresses.            |     
    |                                 |     
    +----------------+----------------+     
                     |                      
                     |                      
                     |                      
  +------------------v-------------------+  
  |                                      |  
  | Get notified from BleManager when one|  
  | of the MAC address are discovered.   |  
  |                                      |  
  +------------------+-------------------+  
                     |                      
                     |                      
                     |                      
     +---------------v--------------+       
     |                              |       
     | Stop Scan when you are done. |       
     |                              |       
     +------------------------------+       

Install WI BLE Library Framework from CocoaPods(iOS 8.0+)

Add below into your Podfile on Xcode.

target YOUR_PROJECT_TARGET do
  pod 'WIBLELib'
end

Install WIBLELib Framework through CocoaPods.

pod repo update
pod install

Now you can see WI BLE framework by inspecting YOUR_PROJECT.xcworkspace.

Create a BleManager that you want to manage the scan process, Assign BleManagerDeleagate to BleManager to get invoked.

class ViewController: UIViewController, BleManagerDeleagate{
  func didDiscoverMac(with mac: String, rssi: Int, timestamp: TimeInterval) {
    // example
    if (rssi > rssiThreashHold) {
      self.stopScanning()
    }
  }

  var manager:BleManager!
  override func viewDidLoad() {
    // on Debug mode
    BleManager.debugMode = true

    // Create BleManager
    manager = BleManager(initWithDelegate: self)
  }

  ...
}

Start scanning by filtering with specific MAC addresses

  // startScanWithmacs
  if (manager.isPowerOn &&    // Support Bluetooth hardware
      !manager.isScanning &&  // Check Already scanning
      manager.startScanWithMacs(targetMacs: targetMacs)) {  // Start Scaning with specific MAC addresses
    // Success
  } else {
    // Failed
  }

Receive the discovery callback from BleManager

  func didDiscoverMac(with mac: String, rssi: Int, timestamp: TimeInterval) {
    // example
    if (rssi > rssiThreashHold) {
      print("Find!! \(mac)")
      // stop Scanning
      self.stopScanning()
    }
  }

Remember to stop scanning when you are done.

  self.stopScanning()