RGLBluetooth

Objective-C

@interface RGLBluetooth : NSObject

/// Device name of connected periphery.
@property (nonatomic, strong, readonly) NSString *deviceName;

/// Indicates whether Redula device flash light is on.
@property (nonatomic, assign, readonly) BOOL isFlashing;

/// Battery level of connected device.
@property (nonatomic, assign, readonly) NSUInteger batteryLevel;

@property (nullable, nonatomic, strong, readonly) NSString *manufacturerName;
@property (nullable, nonatomic, strong, readonly) NSString *modelNumber;
@property (nullable, nonatomic, strong, readonly) NSString *serialNumber;
@property (nullable, nonatomic, strong, readonly) NSString *hardwareRevision;
@property (nullable, nonatomic, strong, readonly) NSString *firmwareRevision;
@property (nullable, nonatomic, strong, readonly) NSString *softwareRevision;
@property (nullable, nonatomic, strong, readonly) NSString *hardwareId;

/// Connection state of connected Regula device
@property (nonatomic, assign, readonly) RGLBluetoothConnectionState state;

/// The delegate object that will receive `RGLBluetooth` events.
@property (nullable, nonatomic, weak) id<RGLBluetoothDelegate> delegate;

- (instancetype)init NS_DESIGNATED_INITIALIZER;

/// Flashes Regula device light.
- (void)actionFlashOn;

/// Starts to establish connection with Regula device.
/// - Parameter deviceName: Name of the device
- (void)connectWithDeviceName:(NSString *)deviceName;

/// Starts to establish connection with Regula device.
/// - Parameter periphery: Periphery instance
- (void)connectPeriphery:(CBPeripheral *)periphery;

/// Scans for all available Regula devices for a short period of time.
/// Callbacks are available through `RGLBluetoothDelegate didFindDevice:bluetooth:device`
- (void)startSearchDevices;

/// Stops Regula devices scanning
- (void)stopSearchDevices;

/// Stops current connection.
- (void)disconnect;

/// Indicates whether Regula Device connected and available for usage
- (BOOL)isPowerOn;

@end

Swift

class Bluetooth : NSObject

Undocumented

  • Device name of connected periphery.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSString *_Nonnull deviceName;

    Swift

    var deviceName: String { get }
  • Indicates whether Redula device flash light is on.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isFlashing;

    Swift

    var isFlashing: Bool { get }
  • Battery level of connected device.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUInteger batteryLevel;

    Swift

    var batteryLevel: UInt { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong, readonly) NSString *manufacturerName

    Swift

    var manufacturerName: String? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong, readonly) NSString *modelNumber

    Swift

    var modelNumber: String? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong, readonly) NSString *serialNumber

    Swift

    var serialNumber: String? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong, readonly) NSString *hardwareRevision

    Swift

    var hardwareRevision: String? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong, readonly) NSString *firmwareRevision

    Swift

    var firmwareRevision: String? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong, readonly) NSString *softwareRevision

    Swift

    var softwareRevision: String? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, strong, readonly) NSString *hardwareId

    Swift

    var hardwareId: String? { get }
  • Connection state of connected Regula device

    Declaration

    Objective-C

    @property (nonatomic, readonly) RGLBluetoothConnectionState state;

    Swift

    var state: BluetoothConnectionState { get }
  • The delegate object that will receive RGLBluetooth events.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<RGLBluetoothDelegate> delegate;

    Swift

    weak var delegate: RGLBluetoothDelegate? { get set }
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_DESIGNATED_INITIALIZER;

    Swift

    init()
  • Flashes Regula device light.

    Declaration

    Objective-C

    - (void)actionFlashOn;

    Swift

    func actionFlashOn()
  • Starts to establish connection with Regula device.

    Declaration

    Objective-C

    - (void)connectWithDeviceName:(nonnull NSString *)deviceName;

    Swift

    func connect(withDeviceName deviceName: String)
  • Starts to establish connection with Regula device.

    Declaration

    Objective-C

    - (void)connectPeriphery:(nonnull CBPeripheral *)periphery;

    Swift

    func connectPeriphery(_ periphery: CBPeripheral)
  • Scans for all available Regula devices for a short period of time. Callbacks are available through RGLBluetoothDelegate didFindDevice:bluetooth:device

    Declaration

    Objective-C

    - (void)startSearchDevices;

    Swift

    func startSearchDevices()
  • Stops Regula devices scanning

    Declaration

    Objective-C

    - (void)stopSearchDevices;

    Swift

    func stopSearchDevices()
  • Stops current connection.

    Declaration

    Objective-C

    - (void)disconnect;

    Swift

    func disconnect()
  • Indicates whether Regula Device connected and available for usage

    Declaration

    Objective-C

    - (BOOL)isPowerOn;

    Swift

    func isPowerOn() -> Bool