Skip to content

Commit

Permalink
Fixed an issue on OS 15.
Browse files Browse the repository at this point in the history
  • Loading branch information
tetujin committed Oct 27, 2022
1 parent 59dac96 commit b9d86d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ESense/Classes/ESenseManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ extension ESenseManager:CBPeripheralDelegate{
}
}else if c.uuid == BATTERY_CHARACTERISTIC {
if let data = c.value {
var bytes = [UInt8](data)
let bytes = [UInt8](data)
if let listener = self.mEventListener{
if (checkCheckSum(bytes, 1)) {
let vol:Double = Double(Int(bytes[3] & 0xff) * 256 + Int(bytes[4] & 0xff)) / 1000.0
Expand All @@ -534,7 +534,7 @@ extension ESenseManager:CBPeripheralDelegate{
}
}else if c.uuid == SENSOR_CHARACTERISTIC{
if let data = c.value {
var bytes = [UInt8](data)
let bytes = [UInt8](data)
// print(bytes)
if(checkCheckSum(bytes, 2)) {
var acc:[Int16] = [0,0,0]
Expand All @@ -559,7 +559,7 @@ extension ESenseManager:CBPeripheralDelegate{
} else if c.uuid == BUTTON_CHARACTERISTIC {
if let listener = self.mEventListener {
if let data = c.value {
var bytes = [UInt8](data)
let bytes = [UInt8](data)
if(checkCheckSum(bytes,1)) {
let value:UInt8 = bytes[3];
listener.onButtonEventChanged(value == 1);
Expand Down
2 changes: 1 addition & 1 deletion ESense/Classes/ESenseScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class ESenseScanner: NSObject, CBCentralManagerDelegate{


public func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
// print(peripheral)
print(peripheral)
if let name = peripheral.name {
if name == self.mDeviceName {
self.mDevice = peripheral
Expand Down
4 changes: 4 additions & 0 deletions Example/ESense/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>eSense client needs to access Bluetooth always to receive sensor data from ear earbuds.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>eSense client needs to access Bluetooth always to receive sensor data from ear earbuds.</string>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
Expand Down

0 comments on commit b9d86d9

Please sign in to comment.