Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Jan 24, 2020
2 parents f4e5c9b + 36806ea commit 02d9dd8
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 60 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Swift

on: [push]

jobs:
build:

runs-on: macOS-latest

steps:
- uses: actions/checkout@v2
- name: Build
run: swift build -v
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// swift-tools-version:5.1

import PackageDescription

let package = Package(
name: "XyBleSdk",
dependencies: [
.Package(url: "https://github.com/google/promises", versions: Version(1, 2, 4)..<Version(1, 2, 5))
.package(url: "https://github.com/google/promises", from: "1.2.8")
]
)
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use_frameworks!
platform :ios, '11.0'

target 'XyBleSdk iOS' do
pod 'PromisesSwift'
pod 'XyBaseSdk'
end

target 'XyBleSdk macOS' do
pod 'PromisesSwift'
pod 'XyBaseSdk'
end
10 changes: 7 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ PODS:
- PromisesObjC (1.2.8)
- PromisesSwift (1.2.8):
- PromisesObjC (= 1.2.8)
- XyBaseSdk (1.0.1):
- PromisesSwift

DEPENDENCIES:
- PromisesSwift
- XyBaseSdk

SPEC REPOS:
trunk:
- PromisesObjC
- PromisesSwift
- XyBaseSdk

SPEC CHECKSUMS:
PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6
PromisesSwift: 37bad6f4daddb02f7c9c531efe91e8b21c13ee2f
XyBaseSdk: 679d4f8ddbfc70ec1ff8a4cbdccf5bf81a1894f2

PODFILE CHECKSUM: 63851cdd7b4395e1cb24e39f40d098f68c212326
PODFILE CHECKSUM: 6fb95eddc80450681cce2057451cd92468db5996

COCOAPODS: 1.8.4
COCOAPODS: 1.9.0.beta.2
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Talking to a Bluetooth device using Core Bluetooth is a drag. The developer need
The XyBleSdk provides a simple interface to communicating with an XY Finder or other Bluetooth device. Let's take a look at an example for an XY Finder device:

```swift
let device = XYFinderDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
let device = XYBluetoothDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
var batteryLevel: Int?
device.connection {
batteryLevel = device.get(BatteryService.level, timeout: .seconds(10)).asInteger
Expand All @@ -114,14 +114,14 @@ device.connection {
}
```

The `XYFinderDeviceFactory` can build a device from a string, peripheral, etc. Using `connection` manages the wrangling of the `CBCentral` and associated `CBPeripheral` delegates, ensuring you have a connection before trying any GATT operation(s) in the block.
The `XYBluetoothDeviceFactory` can build a device from a string, peripheral, etc. Using `connection` manages the wrangling of the `CBCentral` and associated `CBPeripheral` delegates, ensuring you have a connection before trying any GATT operation(s) in the block.

The `get`, `set`, and `notify` methods operate on the specified device and block until the result is returned. This allows the developer to write syncronous code without waiting for a callback or delegate method to be called, or deal with the underlying promises directly. Each operation can also take a timeout if so desired; the default is 30 seconds.

Once all the operations have completed, you can use `then` if there are post actions you wish to run:

```swift
let device = XYFinderDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
let device = XYBluetoothDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
var batteryLevel: Int = 0
device.connection {
batteryLevel = device.get(BatteryService.level, timeout: .seconds(10)).asInteger
Expand All @@ -138,7 +138,7 @@ device.connection {
You can check for an error from your operations by using `hasError` in the result. The error is of type `XYFinderBluetoothError`.

```swift
let device = XYFinderDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
let device = XYBluetoothDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
var batteryLevel: Int = 0
device.connection {
batteryLevel = device.get(BatteryService.level, timeout: .seconds(10)).asInteger
Expand All @@ -156,7 +156,7 @@ device.connection {
If you wish a specific action to always be run regardless of the result, you can use `always`:

```swift
let device = XYFinderDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
let device = XYBluetoothDeviceFactory.build(from: "xy:ibeacon:a44eacf4-0104-0000-0000-5f784c9977b5.20.28772")
var batteryLevel: Int = 0
device.connection {
batteryLevel = device.get(BatteryService.level, timeout: .seconds(10)).asInteger
Expand Down
4 changes: 3 additions & 1 deletion SampleMacOS/SampleMacOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1010;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = "XYO Network";
TargetAttributes = {
31B84C1521D6A40000C95052 = {
Expand Down Expand Up @@ -340,6 +340,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = HFUC9P67W4;
Expand All @@ -362,6 +363,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = HFUC9P67W4;
Expand Down
22 changes: 13 additions & 9 deletions SampleiOS/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
PODS:
- PromisesObjC (1.2.5)
- PromisesSwift (1.2.5):
- PromisesObjC (= 1.2.5)
- XyBleSdk (3.0.6):
- PromisesObjC (1.2.8)
- PromisesSwift (1.2.8):
- PromisesObjC (= 1.2.8)
- XyBaseSdk (1.0.1):
- PromisesSwift
- XyBleSdk (3.0.8):
- XyBaseSdk

DEPENDENCIES:
- XyBleSdk (from `../`)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
trunk:
- PromisesObjC
- PromisesSwift
- XyBaseSdk

EXTERNAL SOURCES:
XyBleSdk:
:path: "../"

SPEC CHECKSUMS:
PromisesObjC: 2b402ef5333bb9b436c74ee1bd7dcb2511b68caf
PromisesSwift: 63d93b8cc31b4245ca1014ff5cc24d6ae952a274
XyBleSdk: 4dc44b737643a564cd77610c96725d0532e07616
PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6
PromisesSwift: 37bad6f4daddb02f7c9c531efe91e8b21c13ee2f
XyBaseSdk: 679d4f8ddbfc70ec1ff8a4cbdccf5bf81a1894f2
XyBleSdk: 21b21d7b4751fa68c279404df2a643381a5ded4b

PODFILE CHECKSUM: 104c0252a97e5cf91ea89ad2a040c51d3d8e8ef6

COCOAPODS: 1.8.4
COCOAPODS: 1.9.0.beta.2
4 changes: 2 additions & 2 deletions SampleiOS/SampleiOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = U726CZ2EVC;
DEVELOPMENT_TEAM = HFUC9P67W4;
INFOPLIST_FILE = SampleiOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -471,7 +471,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = U726CZ2EVC;
DEVELOPMENT_TEAM = HFUC9P67W4;
INFOPLIST_FILE = SampleiOS/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
10 changes: 0 additions & 10 deletions SampleiOS/SampleiOS.xcworkspace/contents.xcworkspacedata

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions XyBleSdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

Pod::Spec.new do |s|
s.name = 'XyBleSdk'
s.version = '3.0.8'
s.version = '3.1.0'
s.license = { :type => 'LGPL3', :file => 'LICENSE' }
s.summary = 'Swift BLE SDK for app developers who want better bluetooth performance'
s.homepage = 'https://github.com/XYOracleNetwork/sdk-ble-swift'
s.social_media_url = 'https://twitter.com/xyodevs'
s.authors = { 'XY - The Persistent Company' => 'developers@xyo.network' }
s.authors = { 'XYO Network' => 'developers@xyo.network' }
s.source = { :git => 'https://github.com/XYOracleNetwork/sdk-ble-swift.git', :tag => s.version }
s.documentation_url = 'https://github.com/XYOracleNetwork/sdk-ble-swift'
s.swift_version = '5.0'
Expand All @@ -22,5 +22,5 @@ Pod::Spec.new do |s|

s.source_files = 'Source/**/*.swift'

s.dependency 'PromisesSwift'
s.dependency 'XyBaseSdk'
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1030"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -51,8 +49,6 @@
ReferencedContainer = "container:XyBleSdk.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1030"
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -51,8 +49,6 @@
ReferencedContainer = "container:XyBleSdk.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
33 changes: 27 additions & 6 deletions XyBleSdk.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

0 comments on commit 02d9dd8

Please sign in to comment.