Skip to content

Commit

Permalink
Updates to allow new cmd families with public access
Browse files Browse the repository at this point in the history
  • Loading branch information
dshalaby committed Dec 3, 2020
1 parent d0ef29b commit 574a1e8
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion TCMP/ApplicationErrorMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import Foundation
@objc
protocol TCMPApplicationErrorMessage{
public protocol TCMPApplicationErrorMessage{
var appErrorCode : UInt8 {get}
var internalErrorCode : UInt8 {get}
var readerStatusCode : UInt8 {get}
Expand Down
2 changes: 1 addition & 1 deletion TCMP/MessageResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
import Foundation
@objc
protocol MessageResolver{
public protocol MessageResolver{
static func resolveCommand(message : TCMPMessage) throws -> TCMPMessage
static func resolveResponse(message : TCMPMessage) throws -> TCMPMessage
}
2 changes: 1 addition & 1 deletion TCMPTappy.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'TCMPTappy'
s.version = '1.1.0'
s.version = '1.2.0'
s.summary = 'SDK for using TapTrack Tappy NFC Readers such as the TappyBLE.'

# This description is used to generate tags and improve search results.
Expand Down
5 changes: 2 additions & 3 deletions TappyBle/TappyBleCommunicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class TappyBleCommunicator : NSObject, CBPeripheralDelegate, CBCentralMan
return
}
NSLog("TappyBleCommunicator: CB Central Manager connected to the tappyPeripheral which is a TappyBle, attempting to discover serial service")
tappyPeripheral.discoverServices([TappyBleDeviceDefinition.getSerialServiceUuid(), TappyBleDeviceDefinition.getSerialServiceUuidV5()])
tappyPeripheral.discoverServices(TappyBleDeviceDefinition.getSerialServiceUuids())
changeStateAndNotify(newState: TappyStatus.STATUS_CONNECTING)
}else{
NSLog("TappyBleCommunicator: CB Central Manager connected to an unrecognized peripheral.")
Expand Down Expand Up @@ -124,7 +124,6 @@ public class TappyBleCommunicator : NSObject, CBPeripheralDelegate, CBCentralMan
}
}


//MARK : CBPeripheralDelegate
@objc
public func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
Expand Down Expand Up @@ -354,7 +353,7 @@ public class TappyBleCommunicator : NSObject, CBPeripheralDelegate, CBCentralMan
state = TappyStatus.STATUS_NOT_READY_TO_CONNECT
}else if(centralManager.state == .poweredOn){
NSLog("TappyBleCommunicator: BLE is powered on")
if centralManager.retrieveConnectedPeripherals(withServices : [TappyBleDeviceDefinition.getSerialServiceUuid(), TappyBleDeviceDefinition.getSerialServiceUuidV5()]).count != 0 {
if centralManager.retrieveConnectedPeripherals(withServices : TappyBleDeviceDefinition.getSerialServiceUuids()).count != 0 {
state = TappyStatus.STATUS_READY
}else{
state = TappyStatus.STATUS_DISCONNECTED
Expand Down
2 changes: 1 addition & 1 deletion TappyBle/TappyBleDevice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Foundation

@objc
public class TappyBleDevice : NSObject {
var deviceName : String
public var deviceName : String
@objc public var deviceId : UUID = UUID()

@objc public init(name : String, deviceId : UUID){
Expand Down
12 changes: 12 additions & 0 deletions TappyBle/TappyBleDeviceDefinition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ import CoreBluetooth
return CHARACTERISTIC_TRUCONNECT_PERIPHERAL_RX_UUID
}

@objc static public func getSerialServiceUuids() -> [CBUUID]{
return [getSerialServiceUuid(),getSerialServiceUuidV5()]
}

@objc static public func getTxCharacteristicUuids() -> [CBUUID]{
return [getTxCharacteristicUuid(),getTxCharacteristicUuidV5()]
}

@objc static public func getRxCharacteristicUuids() -> [CBUUID]{
return [getRxCharacteristicUuid(),getRxCharacteristicUuidV5()]
}

@objc static public func isTappyDeviceName(device : CBPeripheral) -> Bool{
if let peripheralName = device.name{
let upperPName = peripheralName.uppercased()
Expand Down
2 changes: 1 addition & 1 deletion TappyBle/TappyBleScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class TappyBleScanner : NSObject, CBCentralManagerDelegate{

@objc public func startScan() -> Bool{
if state == TappyBleScannerStatus.STATUS_POWERED_ON{
centralManager.scanForPeripherals(withServices: [TappyBleDeviceDefinition.getSerialServiceUuid(), TappyBleDeviceDefinition.getSerialServiceUuidV5()], options: nil)
centralManager.scanForPeripherals(withServices: TappyBleDeviceDefinition.getSerialServiceUuids(), options: nil)
changeStateAndNotify(newState: TappyBleScannerStatus.STATUS_SCANNING)
return true
}
Expand Down
2 changes: 1 addition & 1 deletion TappyReader/TappyStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Foundation
case STATUS_NOT_READY_TO_CONNECT = 7
case STATUS_COMMUNICATOR_ERROR = 8

func getString() -> String{
public func getString() -> String{
switch self {
case .STATUS_DISCONNECTED:
return "STATUS_DISCONNECTED"
Expand Down

0 comments on commit 574a1e8

Please sign in to comment.