Skip to content

Commit

Permalink
iOS example app and demos updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Erkki Silvola committed Apr 15, 2019
1 parent a3ca724 commit 519889e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import UIKit
import PolarBleSdk
import RxSwift

class ViewController: UIViewController, PolarBleApiObserver, PolarBleApiPowerStateObserver, PolarBleApiDeviceFeaturesObserver, PolarBleApiLogger {
class ViewController: UIViewController,
PolarBleApiObserver,
PolarBleApiPowerStateObserver,
PolarBleApiDeviceFeaturesObserver,
PolarBleApiLogger {

func message(_ str: String) {
NSLog(str)
}
Expand Down Expand Up @@ -35,7 +40,7 @@ class ViewController: UIViewController, PolarBleApiObserver, PolarBleApiPowerSta
api.powerStateObserver = self
api.deviceFeaturesObserver = self
//api.logger = self
_ = api.startAutoConnectToPolarDevice(-50, polarDeviceType: nil).subscribe()
_ = api.startAutoConnectToDevice(-50, service: nil, polarDeviceType: nil).subscribe()
connectionStatus.text = ""
}

Expand Down Expand Up @@ -93,16 +98,16 @@ class ViewController: UIViewController, PolarBleApiObserver, PolarBleApiPowerSta
NSLog("FTP CONNECTED")
}

func polarDeviceConnecting(_ identifier: PolarDeviceInfo) {
func deviceConnecting(_ identifier: PolarDeviceInfo) {
connectionStatus.text = "Connecting"
}

func polarDeviceConnected(_ identifier: PolarDeviceInfo) {
func deviceConnected(_ identifier: PolarDeviceInfo) {
deviceId = identifier.deviceId
connectionStatus.text = "Connected"
}

func polarDeviceDisconnected(_ identifier: PolarDeviceInfo) {
func deviceDisconnected(_ identifier: PolarDeviceInfo) {
connectionStatus.text = "Disconnected"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
import UIKit
import PolarBleSdk
import RxSwift
import CoreBluetooth

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, PolarBleApiObserver, PolarBleApiPowerStateObserver, PolarBleApiDeviceInfoObserver, PolarBleApiDeviceFeaturesObserver {

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource,
PolarBleApiObserver,
PolarBleApiPowerStateObserver,
PolarBleApiDeviceInfoObserver,
PolarBleApiDeviceFeaturesObserver {

var api: PolarBleApi!
var deviceId: String?
@IBOutlet weak var connectionStatus: UILabel!
Expand All @@ -32,7 +37,7 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
api.powerStateObserver = self
api.deviceInfoObserver = self
api.deviceFeaturesObserver = self
_ = api.startAutoConnectToPolarDevice(-50, polarDeviceType: "OH1").subscribe()
_ = api.startAutoConnectToDevice(-50, service: CBUUID.init(string: "180D"), polarDeviceType: "OH1").subscribe()
connectionStatus.text = "Disconnected"
}
@IBAction func listExercises(_ sender: Any) {
Expand Down Expand Up @@ -112,18 +117,18 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
}
}

func polarDeviceConnected(_ identifier: PolarDeviceInfo) {
func deviceConnected(_ identifier: PolarDeviceInfo) {
NSLog("Device connected " + identifier.deviceId)
deviceId = identifier.deviceId
connectionStatus.text = "Connected"
}

func polarDeviceConnecting(_ identifier: PolarDeviceInfo) {
func deviceConnecting(_ identifier: PolarDeviceInfo) {
NSLog("Device connecting " + identifier.deviceId)
connectionStatus.text = "Connecting"
}

func polarDeviceDisconnected(_ identifier: PolarDeviceInfo) {
func deviceDisconnected(_ identifier: PolarDeviceInfo) {
NSLog("Device disconnected " + identifier.deviceId)
connectionStatus.text = "Disconnected"
deviceId = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 96TQ43SDNE;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(PROJECT_DIR)/../",
Expand Down Expand Up @@ -371,7 +371,7 @@
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 96TQ43SDNE;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(PROJECT_DIR)/../",
Expand Down

0 comments on commit 519889e

Please sign in to comment.