Skip to content

Commit

Permalink
Release 2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
grjanoszsilabs committed Feb 10, 2022
1 parent 3b1eefd commit 1d31702
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 19 deletions.
8 changes: 4 additions & 4 deletions SiliconLabsApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6624,7 +6624,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_RESOURCE_RULES_PATH = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 46;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 52444FG85C;
DISPLAY_NAME = "EFR Connect";
Expand All @@ -6634,7 +6634,7 @@
INFOPLIST_FILE = "$(SRCROOT)/SiliconLabsApp/SupportingFiles/BlueGecko/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.4.1;
MARKETING_VERSION = 2.4.2;
PRODUCT_BUNDLE_IDENTIFIER = com.silabs.BlueGeckoDemoApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -6658,7 +6658,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_RESOURCE_RULES_PATH = "";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 46;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 52444FG85C;
DISPLAY_NAME = "EFR Connect";
Expand All @@ -6667,7 +6667,7 @@
INFOPLIST_FILE = "$(SRCROOT)/SiliconLabsApp/SupportingFiles/BlueGecko/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.4.1;
MARKETING_VERSION = 2.4.2;
PRODUCT_BUNDLE_IDENTIFIER = com.silabs.BlueGeckoDemoApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
22 changes: 11 additions & 11 deletions SiliconLabsApp/Models/Browser/SILBrowserDescriptorValueParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,26 @@ class SILBrowserDescriptorValueParser: NSObject {
}

private func getEnvironmentalSensingConfiguration(bytes: [UInt8]) -> String {
let firstByte = uint8ToInt(bytes[0])
let lastByte = uint8ToInt(bytes.last!)

switch (firstByte) {
switch (lastByte) {
case 0: return "Boolean AND"
case 1: return "Boolean OR"
default: return "Unknown value: 0x\(bytesToHexString(bytes))"
}
}

private func getCharacteristicExtendedProperties(bytes: [UInt8]) -> String {
let firstByte = bytes[0]
let lastByte = bytes.last!
var result = ""

if firstByte & 0b0000_0001 == 1 {
if lastByte & 0b0000_0001 == 1 {
result.append("Reliable Write enabled, ")
} else {
result.append("Reliable Write disabled, ")
}

if firstByte & 0b0000_0010 == 2 {
if lastByte & 0b0000_0010 == 2 {
result.append("Writable Auxiliaries enabled, ")
} else {
result.append("Writable Auxiliaries disabled, ")
Expand All @@ -112,16 +112,16 @@ class SILBrowserDescriptorValueParser: NSObject {
}

private func getClientCharacteristicConfiguration(bytes: [UInt8]) -> String {
let firstByte = bytes[0]
let lastByte = bytes[bytes.count - 1]
var result = ""

if firstByte & 0b0000_0001 == 1 {
if lastByte & 0b0000_0001 == 1 {
result.append("Notifications enabled, ")
} else {
result.append("Notifications disabled, ")
}

if firstByte & 0b0000_0010 == 2 {
if lastByte & 0b0000_0010 == 2 {
result.append("Indications enabled, ")
} else {
result.append("Indications disabled, ")
Expand All @@ -135,13 +135,13 @@ class SILBrowserDescriptorValueParser: NSObject {
}

private func getServerCharacteristicConfiguration(bytes: [UInt8]) -> String {
let firstByte = bytes[0]
let lastByte = bytes.last!

return firstByte & 0b0000_0001 == 1 ? "Broadcasts enabled" : "Broadcasts disabled"
return lastByte & 0b0000_0001 == 1 ? "Broadcasts enabled" : "Broadcasts disabled"
}

private func getNumberOfDigitals(bytes: [UInt8]) -> String {
let intValue = uint8ToInt(bytes[0])
let intValue = uint8ToInt(bytes.last!)
return String(intValue)
}

Expand Down
2 changes: 1 addition & 1 deletion SiliconLabsApp/SupportingFiles/BlueGecko/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location required for use of Retail Beacons.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Apple thinks the app accesses the user&apos;s photos but we don&apos;t know why.</string>
<string>Apple thinks the app accesses the user's photos but we don't know why.</string>
<key>UIAppFonts</key>
<array>
<string>Roboto-Black.ttf</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,17 @@ class BleManager: NSObject, CBCentralManagerDelegate, DeviceScanner, DeviceConne
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
// RSSI value 127 is Apple-reserved and indicates the RSSI value could not be read.
guard RSSI.intValue != 127,
let peripheralName = advertisementData[CBAdvertisementDataLocalNameKey] as? String,
let manufacturerData = advertisementData[CBAdvertisementDataManufacturerDataKey] as? Data else {
let peripheralName = advertisementData[CBAdvertisementDataLocalNameKey] as? String else {
return
}

let device = bleDeviceForPeripheral(peripheral)

device.name = peripheralName
device.RSSI = RSSI.intValue
device.manufacturerData = manufacturerData
if let manufacturerData = advertisementData[CBAdvertisementDataManufacturerDataKey] as? Data {
device.manufacturerData = manufacturerData
}

if device.advertisementDataLocalName == nil {
device.advertisementDataLocalName = peripheralName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ - (IBAction)handleIndicateViewTap:(id)sender {
[self.characteristicTableModel expandFieldIfNeeded];
}
[self.delegate cell:self didRequestIndicateForCharacteristic:self.characteristic withValue:newNotifyingValue];
[self prepareClientCharacteristicConfigurationDescriptorModelToUpdateCell];
}

- (IBAction)handleNotifyViewTap:(id)sender {
Expand All @@ -208,6 +209,7 @@ - (IBAction)handleNotifyViewTap:(id)sender {
[self.characteristicTableModel expandFieldIfNeeded];
}
[self.delegate cell:self didRequestNotifyForCharacteristic:self.characteristic withValue:newNotifyingValue];
[self prepareClientCharacteristicConfigurationDescriptorModelToUpdateCell];
}

- (IBAction)editName:(UIButton *)sender {
Expand All @@ -216,6 +218,15 @@ - (IBAction)editName:(UIButton *)sender {
}
}

- (void)prepareClientCharacteristicConfigurationDescriptorModelToUpdateCell {
for (SILDescriptorTableModel* descriptorModel in self.descriptorModels) {
if ([descriptorModel.uuidString isEqual:CBUUIDClientCharacteristicConfigurationString]) {
descriptorModel.shouldReadValue = YES;
break;
}
}
}

// MARK: UITableViewDataSource

- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,22 @@ - (void)cell:(SILDebugCharacteristicTableViewCell *)cell didRequestWriteForChara

- (void)cell:(SILDebugCharacteristicTableViewCell *)cell didRequestNotifyForCharacteristic:(CBCharacteristic *)characteristic withValue:(BOOL)value {
[self.peripheral setNotifyValue:value forCharacteristic:characteristic];
[self updateClientCharacteristicConfigurationDescriptorValueForCharacteristic:characteristic];
}

- (void)cell:(SILDebugCharacteristicTableViewCell *)cell didRequestIndicateForCharacteristic:(CBCharacteristic *)characteristic withValue:(BOOL)value {
[self.peripheral setNotifyValue:value forCharacteristic:characteristic];
[self updateClientCharacteristicConfigurationDescriptorValueForCharacteristic:characteristic];
}

- (void)updateClientCharacteristicConfigurationDescriptorValueForCharacteristic:(CBCharacteristic *)characteristic {
for (CBDescriptor *descriptor in characteristic.descriptors) {
if ([descriptor.UUID.UUIDString isEqual:CBUUIDClientCharacteristicConfigurationString]) {
[self.peripheral readValueForDescriptor:descriptor];
break;
}
}
[self refreshTable];
}

#pragma mark = SILDescriptorsTableViewCellDelegate
Expand Down

0 comments on commit 1d31702

Please sign in to comment.