-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more tests to the BLEPeripheralManager (#52)
- Loading branch information
1 parent
68de8fd
commit f1e34d4
Showing
7 changed files
with
119 additions
and
9 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
Sources/BLECombineKit/Peripheral Manager/BLEATTRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// BLEATTRequest.swift | ||
// BLECombineKit | ||
// | ||
// Created by Henry Javier Serrano Echeverria on 06/08/24. | ||
// Copyright © 2024 Henry Serrano. All rights reserved. | ||
// | ||
|
||
import CoreBluetooth | ||
|
||
public protocol BLEATTRequest { | ||
/// Reference to the actual request. Use this getter to obtain the CBATTRequest if needed. Note that CBATTRequest conforms to BLEATTRequest. | ||
var associatedRequest: CBATTRequest? { get } | ||
|
||
/// The wrapper of the central that originated the request. | ||
var centralWrapper: BLECentral { get } | ||
|
||
/// The characteristic whose value will be read or written. | ||
var characteristic: CBCharacteristic { get } | ||
|
||
/// The zero-based index of the first byte for the read or write. | ||
var offset: Int { get } | ||
|
||
/// The data being read or written. For read requests, <i>value</i> will be nil and should be set before responding via @link respondToRequest:withResult: @/link. For write requests, <i>value</i> will contain the data to be written. | ||
var value: Data? { get set } | ||
} | ||
|
||
extension CBATTRequest: BLEATTRequest { | ||
public var associatedRequest: CBATTRequest? { self } | ||
|
||
public var centralWrapper: BLECentral { | ||
central | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// BLECentral.swift | ||
// BLECombineKit | ||
// | ||
// Created by Henry Javier Serrano Echeverria on 06/08/24. | ||
// Copyright © 2024 Henry Serrano. All rights reserved. | ||
// | ||
|
||
import CoreBluetooth | ||
|
||
public protocol BLECentral { | ||
/// Reference to the actual central. Use this getter to obtain the CBCentral if needed. Note that CBCentral conforms to BLECentral. | ||
var associatedCentral: CBCentral? { get } | ||
|
||
/// The UUID associated with the peer. | ||
var identifier: UUID { get } | ||
|
||
/// The maximum amount of data, in bytes, that can be received by the central in a single notification or indication. | ||
var maximumUpdateValueLength: Int { get } | ||
} | ||
|
||
extension CBCentral: BLECentral { | ||
public var associatedCentral: CBCentral? { self } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters