# MinewBeaconAdmin Software Development Kit APi Reference

you can change beacons' parameters around via this SDK, such as: uuid, major, minor and so on. we provided 4 Class to implementation the functions.

# Installation

# CocoaPods

MinewBeaconAdmin is available through CocoaPods (opens new window). To install it, simply add the following line to your Podfile, and then import <MinewBeaconAdmin/MinewBeaconAdmin>:

pod "MinewBeaconAdmin"
1

# Manually

  1. Download the project and drop MinewBeaconAdmin folder into your project.
  2. Import file <MinewBeaconAdmin/MinewBeaconAdmin.h>.
#import <MinewBeaconAdmin/MinewBeaconAdmin.h>
1

# Requirements

This library requires iOS 10.0+.

# Class overview

# MinewBeaconManager

A manager for scanning devices;

functions:

  1. start/stop scanning tasks;

  2. get all devices in range / get all devices scanned;

  3. get bluetooth state;

  4. listen the appear and disappear of devices;

  5. update data of devices scanned(via delegate methods)

  6. listen the changes of bluetooth state(via delegate methods)

# MinewBeacon

Device instance Class

all the properties of this class is read-only, the SDK will update the newest data of devices cyclically(if the device in range).

Function :

  1. export device data to JSON string;
  2. import JSON string;

# MinewBeaconConnection

a connection handle between device and iPhone.

each instance of this class has a MinewBeacon and MinewBeaconSetting(in connection state).

Function:

  1. connect to a device / disconnect from a device;
  2. update the changes of "MinewBeaconSetting" to device (delegate method will tell the operation result)

# MinewBeaconSetting

a instance when device connected

you will get a instance of this class when connect to a device, some of the properties can be modified, the SDK will cache the changes, it will take effective when you update the changes via Connction instance.

Function:

  1. export to JSON string;
  2. import JSON string;

# Get started

# Scan devices

use MinewBeaconManager to scan, SDK will create MinewBeacon instances for devices scanned;


// 1. get minewBeaconManager instance, set a delegate 
MinewBeaconManager *manager = [MinewBeaconManager sharedInstance];
manager.delegate = self;

// 2.start scan
[manager startScan];

// 3.get data update via delegate
// this method execute cyclically for data update.
- (void)minewBeaconManager:(MinewBeaconManager * )manager didRangeBeacons:(NSArray<MinewBeacon *> * )beacons;



/* listen to the appear and disapper status of devices via delegate below*/
// listen to the disappear devices.
- (void)minewBeaconManager:(MinewBeaconManager * )manager disappearBeacons:(NSArray<MinewBeacon *> *)beacons;

// listen to the appear devices.
- (void)minewBeaconManager:(MinewBeaconManager * )manager appearBeacons:(NSArray<MinewBeacon *> *)beacons;

/* listen to the change of bluetooth state */
// state: poweron poweroff unknown
// it will work normally when bluetooth poweron
- (void)minewBeaconManager:(MinewBeaconManager *)manager didUpdateState:(BluetoothState)state;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# Connection

create a "MinewBeaconConnection" instance with a "MinewBeacon" instance, you can manager connect / disconnect / data update via Connection.

// 1. create a Connection instance via a MinewBeacon instance,set a delegate
MinewBeaconConnection *connection = [[MinewBeaconConnection alloc]initWithBeacon:abeacon];
connection.delegate = self;

// 2. connect to a device
[MinewBeaconConnection connect];

// 3.get connection status via delegate method
- (void)beaconConnection:(MinewBeaconConnection *)connection didChangeState:(ConnectionState)state
{
  // the MinewBeaconSetting property of connection instance is not nil when connection status is connected, MinewBeaconSetting is a data model for device.
  if(state == ConnectionStateConnected)
  {
    NSLog(@"connect a device:%@,uuid:%@,major:%d...",connection.setting.name, connection.setting.uuid, connection.setting.major);
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# Device settings

you can modify all read-only properties of setting instance when connection connected, then update to device make it takes effective,

// 1.change the setting property of connection
MinewbeaconSetting *setting = aConnection.setting;
setting.uuid = @"FDA50693-A4E2-4FB1-AFCF-C6EB07647825";
setting.major = 1234;
setting.minor = 4321;
setting.name = @"MinewBeacon";
/*.....*/

// 2.update changes to device.
// !!! be careful, this parameter is a current reboot password;
[aConnection writeSetting:@"minew123"];

// 3. get update result via delegate method
- (void)beaconConnection:(MinewBeaconConnection *)connection didWriteSetting:(BOOL)success
{
   if(success)
     NSLog(@"all changes has updated!");
   else 
     NSLog(@"update failed!");
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# Device shutdown

Currently only B9-9 and B6-B001A devices have the shutdown function.

if (_connection.setting.canBePoweredOff == YES) {
    [_connection writePowerOff];
}
1
2
3

More details, see the demo.

# Other

MinewBeaconAdmin SDK is also used in our BeaconSET app. If you need a more intuitive understanding of our miniBeacon equipment and the corresponding functions of the SDK, you can also download the BeaconSET app to learn more. (Reminder: BeaconSET app and MinewBeaconAdmin SDK need to be used with equipment produced by our company)

# Change log

  • 2017.10.16 v1.0.0 First english version;
  • 2019.12.10 v5.3.3 ;
  • 2020.9.19 v5.3.4 ;
  • 2020.11.25 Optimize the calibration distance setting;
  • 2021.4.21 Add device shutdown function;
  • 2022.4.20 Add info frame support;
  • 2023.2.7 Adapt B6-B001A.
Last Updated:: 1/12/2024, 2:37:29 PM