Skip to content

Commit

Permalink
Release 2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
grjanoszsilabs committed Dec 16, 2021
1 parent c3830dc commit f3c1ccb
Show file tree
Hide file tree
Showing 608 changed files with 244,262 additions and 574 deletions.
2 changes: 2 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def shared_pods
pod 'Realm', '~> 4.3.2'
pod 'RealmSwift'
pod 'AEXML'
pod 'RxSwift', '~> 6.2.0'
pod 'RxCocoa', '~> 6.2.0'
end

def test_pods
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ EFR Connect includes many demos to test sample apps in the Silicon Labs GSDK qui
- **Health Thermometer**: Connect to a BLE hardware kit and receive the temperature data from the on-board sensor.
- **Connected Lighting DMP**: Leverage the dynamic multi-protocol (DMP) sample apps to control a DMP light node from a mobile and protocol-specific switch node (Zigbee, proprietary) while keeping the light status in sync across all devices.
- **Range Test**: Visualize the RSSI and other RF performance data on the mobile phone while running the Range Test sample application on a pair of Silicon Labs radio boards.
- **Motion**: Control a 3D render of a Silicon Labs Thunderboard or Dev Kit that follows the phyiscal board movements.
- **Environment**: Read and display the data from the on-board sensors on a Silicon Labs Thunderboard or Dev Kit.
- **Wi-Fi Commissioning**: Commission a Wi-Fi device over BLE.

## Development Features
EFR Connect helps developers create and troubleshoot Bluetooth applications running on Silicon Labs’ BLE hardware. Here’s a rundown of some example functionalities.
Expand Down
5 changes: 2 additions & 3 deletions SiliconLabsApp-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#import "SILBluetoothXMLParser.h"
#import "UIView+SILShadow.h"
#import "SILDeviceSelectionViewModel.h"
#import "SILDeviceSelectionViewController.h"
#import "NSObject+SILAssociatedObject.h"
#import "SILDescriptorTableModel.h"
#import "SILSortOption.h"
Expand All @@ -57,7 +56,6 @@
#import "CBPeripheral+Services.h"
#import "CBService+Categories.h"
#import "SILOTAProgressViewController.h"
#import "SILDeviceSelectionViewController.h"
#import "SILAppSelectionInfoViewController.h"
#import "SILHealthThermometerAppViewController.h"
#import "SILConnectedLightingViewController.h"
Expand All @@ -76,7 +74,8 @@
#import "SILLogDataModel.h"
#import "SILDescriptorTableModel.h"
#import "CBPeripheral+Services.h"
#import "SILDeviceSelectionViewController.h"
#import "SILAppSelectionInfoViewController.h"
#import "SILHealthThermometerAppViewController.h"
#import "SILConnectedLightingViewController.h"
#import "SILAppSelectionHelpViewController.h"
#import "SILDeviceSelectionCollectionViewCell.h"
965 changes: 823 additions & 142 deletions SiliconLabsApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ enum SILBluetoothDisabledAlert: Int {
case throughput
case gattConfigurator
case blinky
case motion
case environment
case wifiCommissioning

var title: String {
"Bluetooth Disabled"
Expand Down Expand Up @@ -46,6 +49,12 @@ enum SILBluetoothDisabledAlert: Int {
return "\(turnOnMsg) start any GATT Server."
case .blinky:
return "\(backMsg) \(turnOnMsg) use Blinky."
case .motion:
return "\(backMsg) \(turnOnMsg) use Motion"
case .environment:
return "\(backMsg) \(turnOnMsg) use Environment"
case .wifiCommissioning:
return "\(backMsg) \(turnOnMsg) use WiFi Commissioning"
}
}
}
Expand Down
124 changes: 124 additions & 0 deletions SiliconLabsApp/BluetoothControllers/SILPeripheralDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
//
// SILPeripheralDelegate.swift
// BlueGecko
//
// Created by Kamil Czajka on 29.3.2021.
// Copyright © 2021 SiliconLabs. All rights reserved.
//

import Foundation

enum SILPeripheralDelegateStatus {
case successForServices(_ services: [CBService])
case successForCharacteristics(_ characteristics: [CBCharacteristic])
case successGetValue(value: Data?, characteristic: CBCharacteristic)
case successWrite(characteristic: CBCharacteristic)
case updateNotificationState(characteristic: CBCharacteristic, state: Bool)
case servicesModified(peripheral: CBPeripheral)
case failure(error: Error)
case unknown
}

class SILPeripheralDelegate: NSObject, CBPeripheralDelegate {
private var peripheral: CBPeripheral

var status: SILObservable<SILPeripheralDelegateStatus> = SILObservable(initialValue: .unknown)

init(peripheral: CBPeripheral) {
self.peripheral = peripheral
super.init()
self.peripheral.delegate = self
}

func updatePeripheral(peripheral: CBPeripheral) {
self.peripheral = peripheral
self.peripheral.delegate = self
}

func newStatus() -> SILObservable<SILPeripheralDelegateStatus> {
status = SILObservable(initialValue: .unknown)
return status
}

func discoverServices(services: [CBUUID]?) {
self.peripheral.discoverServices(services)
}

func discoverCharacteristics(characteristics: [CBUUID]?, for service: CBService) {
self.peripheral.discoverCharacteristics(characteristics, for: service)
}

func readCharacteristic(characteristic: CBCharacteristic) {
self.peripheral.readValue(for: characteristic)
}

func writeToCharacteristic(data: Data, characteristic: CBCharacteristic, writeType: CBCharacteristicWriteType) {
self.peripheral.writeValue(data, for: characteristic, type: writeType)
}

func notifyCharacteristic(characteristic: CBCharacteristic, enabled: Bool = true) {
self.peripheral.setNotifyValue(enabled, for: characteristic)
}

func getMTUValue(for writeType: CBCharacteristicWriteType) -> Int {
return self.peripheral.maximumWriteValueLength(for: writeType)
}

func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
debugPrint("didDiscoverServices**********")
if let error = error {
status.value = .failure(error: error)
} else {
status.value = .successForServices(peripheral.services!)
}
}

func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
debugPrint("didDiscoverCharacteristics*********")
if let error = error {
status.value = .failure(error: error)
} else {
status.value = .successForCharacteristics(service.characteristics!)
}
}

func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
debugPrint("didUpdateValueForCharacteristic*********")
if let error = error {
status.value = .failure(error: error)
} else {
status.value = .successGetValue(value: characteristic.value, characteristic: characteristic)
}
}

func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Error?) {
debugPrint("didWriteValueForCharacteristic*********")
if let error = error {
status.value = .failure(error: error)
} else {
status.value = .successWrite(characteristic: characteristic)
}
}

func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) {
debugPrint("didUpdateNotificationStateFor*********")
if let error = error {
status.value = .failure(error: error)
} else {
status.value = .updateNotificationState(characteristic: characteristic, state: characteristic.isNotifying)
}
}

func peripheral(_ peripheral: CBPeripheral, didModifyServices invalidatedServices: [CBService]) {
debugPrint("didMofifyServices*********")
status.value = .servicesModified(peripheral: peripheral)
}

func findService(with serviceUUID: CBUUID, in peripheral: CBPeripheral) -> CBService? {
return peripheral.services?.first(where: { service in service.uuid == serviceUUID})
}

func findCharacteristic(with characteristicUUID: CBUUID, in characteristics: [CBCharacteristic]) -> CBCharacteristic? {
return characteristics.first(where: { characteristic in characteristic.uuid == characteristicUUID })
}
}
8 changes: 4 additions & 4 deletions SiliconLabsApp/Categories/Data+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ extension Data {
return value
}

var hexDescription: String {
return reduce("") {$0 + String(format: "%02x", $1)}
}

fileprivate func convertData(data: Data) -> [UInt8] {
return [UInt8](data)
}
Expand All @@ -38,4 +34,8 @@ extension Data {
}
return value
}

var hexDescription: String {
return reduce("") {$0 + String(format: "%02x", $1)}
}
}
29 changes: 29 additions & 0 deletions SiliconLabsApp/Categories/String+Subscript.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// String+Subscript.swift
// BlueGecko
//
// Created by Grzegorz Janosz on 19/11/2021.
// Copyright © 2021 SiliconLabs. All rights reserved.
//

import Foundation

extension String {
subscript(_ i: Int) -> String {
let idx1 = index(startIndex, offsetBy: i)
let idx2 = index(idx1, offsetBy: 1)
return String(self[idx1..<idx2])
}

subscript (r: Range<Int>) -> String {
let start = index(startIndex, offsetBy: r.lowerBound)
let end = index(startIndex, offsetBy: r.upperBound)
return String(self[start ..< end])
}

subscript (r: CountableClosedRange<Int>) -> String {
let startIndex = self.index(self.startIndex, offsetBy: r.lowerBound)
let endIndex = self.index(startIndex, offsetBy: r.upperBound - r.lowerBound)
return String(self[startIndex...endIndex])
}
}
15 changes: 15 additions & 0 deletions SiliconLabsApp/Categories/String+VersionCompare.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// String+VersionCompare.swift
// BlueGecko
//
// Created by Grzegorz Janosz on 10/12/2021.
// Copyright © 2021 SiliconLabs. All rights reserved.
//

import Foundation

extension String {
func versionCompare(_ otherVersion: String) -> ComparisonResult {
return self.compare(otherVersion, options: .numeric)
}
}
36 changes: 18 additions & 18 deletions SiliconLabsApp/Categories/UIColor+SILColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
// Created by Jan Wisniewski on 05/03/2020.
// Copyright © 2020 SiliconLabs. All rights reserved.
//

import Foundation


extension UIColor {

class func tb_hex(_ hex: Int) -> UIColor {
return UIColor(
red: CGFloat((hex & 0xFF0000) >> 16) / 255.0,
green: CGFloat((hex & 0x00FF00) >> 8) / 255.0,
blue: CGFloat((hex & 0x0000FF) >> 0) / 255.0,
alpha: 1.0)
}

class var vileRed: UIColor {
get { return UIColor.tb_hex(0xD91E2A) }
}
}
//
//import Foundation
//
//
//extension UIColor {
//
// class func tb_hex(_ hex: Int) -> UIColor {
// return UIColor(
// red: CGFloat((hex & 0xFF0000) >> 16) / 255.0,
// green: CGFloat((hex & 0x00FF00) >> 8) / 255.0,
// blue: CGFloat((hex & 0x0000FF) >> 0) / 255.0,
// alpha: 1.0)
// }
//
// class var vileRed: UIColor {
// get { return UIColor.tb_hex(0xD91E2A) }
// }
//}
3 changes: 3 additions & 0 deletions SiliconLabsApp/Categories/UIImage+SILImages.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ extern NSString * const SILImageNameHomeIOPTester;
extern NSString * const SILImageNameHomeThroughput;
extern NSString * const SILImageNameHomeGattConfigurator;
extern NSString * const SILImageNameHomeBlinky;
extern NSString * const SILImageNameHomeMotion;
extern NSString * const SILImageNameHomeEnvironment;
extern NSString * const SILImageNameHomeWifiCommissioning;

extern NSString * const SILImageNameKeyboard;
extern NSString * const SILImageNameKeyboardCheckmark;
Expand Down
3 changes: 3 additions & 0 deletions SiliconLabsApp/Categories/UIImage+SILImages.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
NSString * const SILImageNameHomeThroughput = @"throughput";
NSString * const SILImageNameHomeGattConfigurator = @"gattConfigurator";
NSString * const SILImageNameHomeBlinky = @"graphic - blinky";
NSString * const SILImageNameHomeMotion = @"icon - motion";
NSString * const SILImageNameHomeEnvironment = @"icon - environment";
NSString * const SILImageNameHomeWifiCommissioning = @"icon - wifi commissioning";

NSString * const SILImageNameKeyboard = @"Keyboard";
NSString * const SILImageNameKeyboardCheckmark = @"KeyboardCheckmark";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ - (NSString *)primaryTitle {
}

- (NSString *)secondaryTitle {
return self.fieldModel.name;
return [NSString stringWithFormat: @"%@ - %@", self.fieldModel.name, self.bit.name];
}

- (void)clearValues {
Expand Down
3 changes: 3 additions & 0 deletions SiliconLabsApp/Models/SILApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ typedef NS_ENUM(NSInteger, SILAppType) {
SILAppIopTest,
SILAppTypeGATTConfigurator,
SILAppTypeThroughput,
SILAppTypeMotion,
SILAppTypeEnvironment,
SILAppTypeWifiCommissioning
};

@interface SILApp : NSObject
Expand Down
27 changes: 27 additions & 0 deletions SiliconLabsApp/Models/SILApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ + (NSArray *)demoApps {
[self rangeTestApp],
[self blinkyApp],
[self throughputApp],
[self motionApp],
[self environmentApp],
[self wifiCommissioningApp]
];
}

Expand Down Expand Up @@ -118,6 +121,30 @@ + (SILApp *)throughputApp {
imageName:SILImageNameHomeThroughput];
}

+ (SILApp *)motionApp {
return [[SILApp alloc] initWithAppType:SILAppTypeMotion
title:@"Motion"
description:@"Control a 3D render of a dev kit."
showcasedProfiles:@{}
imageName:SILImageNameHomeMotion];
}

+ (SILApp *)environmentApp {
return [[SILApp alloc] initWithAppType:SILAppTypeEnvironment
title:@"Environment"
description:@"Read and display data from the dev kit sensors."
showcasedProfiles:@{}
imageName:SILImageNameHomeEnvironment];
}

+ (SILApp *)wifiCommissioningApp {
return [[SILApp alloc] initWithAppType:SILAppTypeWifiCommissioning
title:@"Wi-Fi Commissioning"
description:@"Wi-Fi commissioning over BLE."
showcasedProfiles:@{}
imageName:SILImageNameHomeWifiCommissioning];
}

- (instancetype)initWithAppType:(SILAppType)appType
title:(NSString *)title
description:(NSString *)description
Expand Down
1 change: 1 addition & 0 deletions SiliconLabsApp/Models/SILBitFieldFieldModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ - (instancetype)initBitFieldWithField:(SILBluetoothFieldModel *)fieldModel {
if (self) {
self.fieldModel = fieldModel;
self.bitRowFields = [self initbitRowModels];
self.requirementsSatisfied = YES;
}
return self;
}
Expand Down
Loading

0 comments on commit f3c1ccb

Please sign in to comment.