Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shu223/peripherallogger
Logger for Core Bluetooth development.
https://github.com/shu223/peripherallogger
Last synced: about 2 months ago
JSON representation
Logger for Core Bluetooth development.
- Host: GitHub
- URL: https://github.com/shu223/peripherallogger
- Owner: shu223
- License: mit
- Created: 2015-03-13T13:52:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-13T09:06:39.000Z (over 8 years ago)
- Last Synced: 2024-05-01T20:40:26.602Z (8 months ago)
- Language: Objective-C
- Homepage:
- Size: 26.4 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PeripheralLogger
PeripheralLogger exports log files separately for each CBPeripheral object.
##How to use
**Just add TTMPeripheralLogger.{h,m} into your project.**
(CocoaPods will be supported soon!)
###Simplest
Use `PeripheralLog` macro.
(example)
```objc
- (void) centralManager:(CBCentralManager *)central
didConnectPeripheral:(CBPeripheral *)peripheral
{
PeripheralLog(peripheral);// (do something)
}
```Log files are created into `Caches/Logs` separately for each peripheral object, and each the time, method, `name`, `state` are output.
> 21:51:58 centralManager:didConnectPeripheral: name:shuPhone6plus state:Connected
###Formatted
Use `PeripheralLogF` macro.
(examples)
```objc
- (void) centralManager:(CBCentralManager *)central
didDiscoverPeripheral:(CBPeripheral *)peripheral
advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
PeripheralLogF(peripheral, @"advertisementData:%@, RSSI:%@", advertisementData, RSSI);// do something
}
``````objc
- (void) peripheral:(CBPeripheral *)peripheral
didDiscoverServices:(NSError *)error
{
PeripheralLogF(peripheral, @"error:%@, services:%@", error, peripheral.services);// do something
}
```> 21:51:58 centralManager:didDiscoverPeripheral:advertisementData:RSSI: name:shuPhone6plus state:Disconnected
advertisementData:{
kCBAdvDataHashedServiceUUIDs = (
"EB115BE0-A9E8-4E11-99E1-53E510FBA9E6"
);
kCBAdvDataIsConnectable = 1;
}, RSSI:-49> 21:51:59 peripheral:didDiscoverServices: name:shuPhone6plus state:Connected
error:(null), services:(
""
)##Sample Logs
See "SampleLogs" folder in this repository.