Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Sources/Classes/Public/ActiveLookSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ public class ActiveLookSDK {

guard let discoveredGlasses = discoveredGlasses(fromPeripheral: glasses.peripheral)
else {
fatalError("discoveredGlasses not found")
print("discoveredGlasses not found")
return
}

updater?.update(
Expand Down Expand Up @@ -495,7 +496,8 @@ public class ActiveLookSDK {
print("central manager did update state: ", central.state.rawValue)

guard let parent = parent else {
fatalError("cannot retrieve parent instance")
print("cannot retrieve parent instance")
return
}

if central.state == .poweredOff {
Expand Down Expand Up @@ -544,7 +546,8 @@ public class ActiveLookSDK {
rssi RSSI: NSNumber)
{
guard let parent = parent else {
fatalError("cannot retrieve parent instance")
print("cannot retrieve parent instance")
return
}
guard parent.peripheralIsActiveLookGlasses(peripheral: peripheral,
advertisementData: advertisementData)
Expand Down Expand Up @@ -572,7 +575,8 @@ public class ActiveLookSDK {
didConnect peripheral: CBPeripheral)
{
guard let parent = parent else {
fatalError("cannot retrieve parent instance")
print("cannot retrieve parent instance")
return
}

guard let discoveredGlasses: DiscoveredGlasses = parent.discoveredGlasses(fromPeripheral: peripheral)
Expand Down Expand Up @@ -616,7 +620,8 @@ public class ActiveLookSDK {
error: Error?)
{
guard let parent = parent else {
fatalError("cannot retrieve parent instance")
print("cannot retrieve parent instance")
return
}

guard let glasses = parent.connectedGlasses(fromPeripheral: peripheral) else {
Expand Down
6 changes: 2 additions & 4 deletions Sources/Classes/Public/Glasses.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ public class Glasses {
/// sends the bytes queued in commandQueue
private func sendBytes()
{
if flowControlState != FlowControlState.on { return }

if rxCharacteristicState == .busy { return }
guard flowControlState == .on, let rxCharacteristic, rxCharacteristicState != .busy else { return }

guard let value = commandQueue.dequeue() else {
if isUpdating {
Expand All @@ -340,7 +338,7 @@ public class Glasses {
}
}

peripheral.writeValue(value, for: rxCharacteristic!, type: .withResponse)
peripheral.writeValue(value, for: rxCharacteristic, type: .withResponse)

rxCharacteristicState = .busy
}
Expand Down