Skip to content

Commit

Permalink
fix command name
Browse files Browse the repository at this point in the history
prevent setting a period lower than 250ms
avoid use too low value for periods
remove demo command from general
fix dim example commands
fix bad link to xcode workspace
  • Loading branch information
Activelook-dev committed Dec 10, 2021
1 parent d78d948 commit 9e1cb59
Show file tree
Hide file tree
Showing 167 changed files with 32,341 additions and 1 deletion.
43 changes: 43 additions & 0 deletions ActiveLookSDK.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Be sure to run `pod lib lint ActiveLookSDK.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'ActiveLookSDK'
s.version = '0.1.0'
s.summary = 'A library to allow interaction between an iOS app and Active Look glasses'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!

s.description = <<-DESC
This CocoaPod provides the ability to connect to ActiveLook glasses and send various commands
DESC

s.homepage = 'https://git.rwigo.com/microoled/activelook-sdk'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'Apache', :file => 'LICENSE' }
s.source = { :git => 'https://git.rwigo.com/microoled/activelook-sdk/demo-ios.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

s.ios.deployment_target = '9.0'

s.source_files = 'ActiveLookSDK/Classes/**/*'

s.swift_version = '5.0'

# s.resource_bundles = {
# 'ActiveLookSDK' => ['ActiveLookSDK/Assets/*.png']
# }

# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
Binary file added ActiveLookSDK.xcworkspace
Binary file not shown.
27 changes: 27 additions & 0 deletions Classes/Internal/Array+ActiveLook.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*

Copyright 2021 Microoled
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

import Foundation

extension Array {
func chunked(into size: Int) -> [[Element]] {
return stride(from: 0, to: count, by: size).map {
Array(self[$0 ..< Swift.min($0 + size, count)])
}
}
}



34 changes: 34 additions & 0 deletions Classes/Internal/CBCharacteristic+ActiveLook.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*

Copyright 2021 Microoled
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

import Foundation
import CoreBluetooth

extension CBCharacteristic {

var valueAsUTF8: String {
if let value = self.value {
return String(decoding: value, as: UTF8.self)
}
return ""
}

var valueAsInt: Int {
if let value = self.value {
return Int([UInt8](value)[0])
}
return 0
}
}
27 changes: 27 additions & 0 deletions Classes/Internal/CBPeripheral+ActiveLook.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*

Copyright 2021 Microoled
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

import Foundation
import CoreBluetooth

extension CBPeripheral {

func getService(withUUID uuid: CBUUID) -> CBService? {
if let services = self.services, let index = services.firstIndex(where: { $0.uuid == uuid }) {
return services[index]
}
return nil
}
}
27 changes: 27 additions & 0 deletions Classes/Internal/CBService+ActiveLook.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*

Copyright 2021 Microoled
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

import Foundation
import CoreBluetooth

extension CBService {

func getCharacteristic(forUUID uuid: CBUUID) -> CBCharacteristic? {
if let characteristics = self.characteristics, let index = characteristics.firstIndex(where: { $0.uuid == uuid }) {
return characteristics[index]
}
return nil
}
}
63 changes: 63 additions & 0 deletions Classes/Internal/CBUUID+ActiveLook.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*

Copyright 2021 Microoled
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

import Foundation
import CoreBluetooth

extension CBUUID {


// MARK: - Generic access service and characteristics identifiers

static let GenericAccessService = CBUUID.init(string: "00001800-0000-1000-8000-00805f9b34fb")

static let DeviceNameCharacteristic = CBUUID.init(string: "00002a00-0000-1000-8000-00805f9b34fb")
static let AppearanceCharacteristic = CBUUID.init(string: "00002a01-0000-1000-8000-00805f9b34fb")
static let PeripheralPreferredConnectionParametersCharacteristic = CBUUID.init(string: "00002a02-0000-1000-8000-00805f9b34fb")


// MARK: - Device information service and characteristics identifiers

static let DeviceInformationService = CBUUID.init(string: "0000180a-0000-1000-8000-00805f9b34fb")

static let ManufacturerNameCharacteristic = CBUUID.init(string: "00002a29-0000-1000-8000-00805f9b34fb")
static let ModelNumberCharacteristic = CBUUID.init(string: "00002a24-0000-1000-8000-00805f9b34fb")
static let SerialNumberCharateristic = CBUUID.init(string: "00002a25-0000-1000-8000-00805f9b34fb")
static let HardwareVersionCharateristic = CBUUID.init(string: "00002a27-0000-1000-8000-00805f9b34fb")
static let FirmwareVersionCharateristic = CBUUID.init(string: "00002a26-0000-1000-8000-00805f9b34fb")
static let SoftwareVersionCharateristic = CBUUID.init(string: "00002a28-0000-1000-8000-00805f9b34fb")

static let DeviceInformationCharacteristicsUUIDs = [ManufacturerNameCharacteristic, ModelNumberCharacteristic, SerialNumberCharateristic, HardwareVersionCharateristic, FirmwareVersionCharateristic, SoftwareVersionCharateristic]


// MARK: - Battery service and characteristics identifiers

static let BatteryService = CBUUID.init(string: "0000180f-0000-1000-8000-00805f9b34fb")

static let BatteryLevelCharacteristic = CBUUID.init(string: "00002a19-0000-1000-8000-00805f9b34fb")


// MARK: - ActiveLook services and characteristics identifiers

static let ActiveLookCommandsInterfaceService = CBUUID.init(string: "0783b03e-8535-b5a0-7140-a304d2495cb7")

static let ActiveLookTxCharacteristic = CBUUID.init(string: "0783b03e-8535-b5a0-7140-a304d2495cb8")
static let ActiveLookRxCharacteristic = CBUUID.init(string: "0783b03e-8535-b5a0-7140-a304d2495cba")
static let ActiveLookUICharacteristic = CBUUID.init(string: "0783b03e-8535-b5a0-7140-a304d2495cbc")
static let ActiveLookFlowControlCharacteristic = CBUUID.init(string: "0783b03e-8535-b5a0-7140-a304d2495cb9")
static let ActiveLookSensorInterfaceCharacteristic = CBUUID.init(string: "0783b03e-8535-b5a0-7140-a304d2495cbb")

static let ActiveLookCharacteristicsUUIDS = [ActiveLookTxCharacteristic, ActiveLookRxCharacteristic, ActiveLookUICharacteristic, ActiveLookFlowControlCharacteristic, ActiveLookSensorInterfaceCharacteristic]
}
103 changes: 103 additions & 0 deletions Classes/Internal/CommandID.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*

Copyright 2021 Microoled
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

import Foundation

internal enum CommandID: UInt8 {

case power = 0x00
case clear = 0x01
case grey = 0x02
case demo = 0x03
case test = 0x04
case battery = 0x05
case vers = 0x06
case debug = 0x07
case led = 0x08
case shift = 0x09
case settings = 0x0A
case setName = 0x0B

case luma = 0x10
case dim = 0x11

case sensor = 0x20
case gesture = 0x21
case als = 0x22
case setSensorParameters = 0x23
case getSensorParameters = 0x24

case color = 0x30
case point = 0x31
case line = 0x32
case rect = 0x33
case rectf = 0x34
case circ = 0x35
case circf = 0x36
case txt = 0x37
case polyline = 0x38

case imgList = 0x40
case imgSave = 0x41
case imgDisplay = 0x42
case imgDelete = 0x43
case imgStream = 0x44
case imgSave1bpp = 0x45

case fontList = 0x50
case fontSave = 0x51
case fontSelect = 0x52
case fontDelete = 0x53

case layoutSave = 0x60
case layoutDelete = 0x61
case layoutDisplay = 0x62
case layoutClear = 0x63
case layoutList = 0x64
case layoutPosition = 0x65
case layoutDisplayExtended = 0x66
case layoutGet = 0x67

case gaugeDisplay = 0x70
case gaugeSave = 0x71

case pageSave = 0x80
case pageGet = 0x81
case pageDelete = 0x82
case pageDisplay = 0x83
case pageClear = 0x84
case pageList = 0x85

case pixelCount = 0xA5
case setPixelValue = 0xA6
case getChargingCounter = 0xA7
case getChargingTime = 0xA8
case getMaxPixelValue = 0xA9
case resetChargingParam = 0xAA

case wConfigID = 0xA1
case rConfigID = 0xA2
case setConfigID = 0xA3

// case cfgWrite = 0xD0
// case cfgRead = 0xD1
// case cfgSet = 0xD2
// case cfgList = 0xD3
// case cfgRename = 0xD4
// case cfgDelete = 0xD5
// case cfgDeleteOldest = 0xD6
// case cfgFreeSpace = 0xD7
// case cfdGetNb = 0xD8
}
20 changes: 20 additions & 0 deletions Classes/Internal/Data+HexEncodedString.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*

Copyright 2021 Microoled
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

*/

extension Data {
func hexEncodedString() -> String {
return map { String(format: "%02hhx", $0) }.joined()
}
}
Loading

0 comments on commit 9e1cb59

Please sign in to comment.