zoyi / WIBLELib-Sample-objc

WIBLELib Example for objective-c

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Walkinsights - Offline Customer Analytics

Walkinsights 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

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. |       
     |                              |       
     +------------------------------+       

How to use it

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.

@interface ViewController : UIViewController<BleManagerDeleagate>
  @property BleManager* manager;
...
@end

Start scanning by filtering with specific MAC addresses

  // startScanWithmacs
  if (![_manager isScanning] &&
      [_manager isPowerOn] &&
      [_manager startScanWithMacsWithTargetMacs:macs])
  {
    // Success
  } else {
    // Failed
  }

Receive the discovery callback from BleManager

  - (void)didDiscoverMacWith:(NSString * _Nonnull)mac rssi:(NSInteger)rssi timestamp:(NSTimeInterval)timestamp {
    if (rssi > [self rssiThreashHold]) {
      [self stopScanning];
    }
  }

Remember to stop scanning when you are done.

  [_manager stopScan];

About

WIBLELib Example for objective-c


Languages

Language:Objective-C 95.6%Language:Ruby 4.4%