Skip to content

Commit 72cf5ea

Browse files
committed
Reverts unintended changes to readme.md and .gitattributes
Changes the max data size for each write to the minimum of maximumWriteValueLengthForType: for type CBCharacteristicWriteWithResponse or CBCharacteristicWriteWithoutResponse.
1 parent 28417ec commit 72cf5ea

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
*.m text
1010
*.h text
1111
*.pch text
12+
*.a51 text
13+
*.A51 text
1214
*.SRC text
1315
*.src text
1416
*.ld text
@@ -20,6 +22,15 @@ Makefile text
2022
# Project files for various tools
2123
# Some are binary, some text, and some require CRLF
2224

25+
.project text eol=crlf
26+
.cproject text eol=crlf
27+
*.slsproj text eol=crlf
28+
*.hwconf text eol=crlf
29+
*.uvopt text eol=crlf
30+
*.uvproj text eol=crlf
31+
*.wsp text eol=crlf
32+
*.abp text eol=crlf
33+
*.cwg binary
2334
*.pbxproj text eol=lf
2435
*.plist text eol=lf
2536
*.xib text eol=lf
@@ -50,3 +61,6 @@ Doxyfile.* text
5061
*.class binary
5162
*.jar binary
5263

64+
# treat hex files as binary so they just get replaced instead
65+
# of attempted merge
66+
*.hex binary

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ README
33

44
![alt text](http://pages.silabs.com/rs/634-SLU-379/images/BGX-transparent-450x450.png)
55

6-
76
This is the repository for holding the source code for the Wireless Xpress
87
code bases, including Silicon Labs BGX13 mobile frameworks and applications,
98
and demos for AMW007 and BGX13.
@@ -14,9 +13,9 @@ https://www.silabs.com/products/wireless/bluetooth/xpress
1413
You can find more information about the AMW007 here
1514
https://www.silabs.com/products/wireless/wi-fi/xpress
1615

17-
The official documentation is found here https://docs.silabs.com/bgx, or on
18-
Github at https://siliconlabs.github.io/wireless-xpress. Documentation for
19-
AMW007 can be found at https://docs.silabs.com/wgx.
16+
The official documentation for BGX13 is found at https://docs.silabs.com/gecko-os/1/bgx/latest/.
17+
18+
Documentation for AMW007 can be found at https://docs.silabs.com/gecko-os/amw007-w00001/2.0/.
2019

2120
The source code repository is on Github at
2221
https://github.com/SiliconLabs/wireless-xpress
@@ -38,4 +37,4 @@ Support
3837
-------
3938

4039
Please use the [Silicon Labs Support Portal](https://www.silabs.com/support/)
41-
for all support requests.
40+
for all support requests.

iOS/BGXpress/bgxpress/BGXDevice.m

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ @implementation BGXDevice
4747

4848
__weak NSTimer * rssiTimer;
4949
BOOL _acknowledgedWrites;
50+
51+
52+
NSUInteger _dataWriteSize;
5053
}
5154

5255

@@ -71,6 +74,7 @@ - (id)initWithCBPeripheral:(CBPeripheral *)peripheralParam advertisementData:(NS
7174
_connectionTimer = nil;
7275
rssiTimer = nil;
7376
_acknowledgedWrites = YES;
77+
_dataWriteSize = 0;
7478

7579
}
7680
return self;
@@ -167,6 +171,7 @@ - (void)deviceDidDisconnect
167171
modeChar = nil;
168172
firRevStrChar = nil;
169173
deviceUniqueIdenChar = nil;
174+
_dataWriteSize = 0;
170175
}
171176

172177

@@ -234,6 +239,18 @@ - (BOOL) writeData:(NSData *) data
234239
{
235240
return NO;
236241
}
242+
243+
if ( 0 == _dataWriteSize) {
244+
NSUInteger writeWithout = [self.peripheral maximumWriteValueLengthForType: CBCharacteristicWriteWithoutResponse];
245+
NSUInteger writeWith = [self.peripheral maximumWriteValueLengthForType: CBCharacteristicWriteWithResponse];
246+
247+
if (writeWithout < writeWith) {
248+
_dataWriteSize = writeWithout;
249+
} else {
250+
_dataWriteSize = writeWith;
251+
}
252+
}
253+
237254
dataToWrite = [NSData dataWithData:data];
238255
range.location = 0;
239256
[self writeChunkOfData];
@@ -243,12 +260,11 @@ - (BOOL) writeData:(NSData *) data
243260

244261
- (void) writeChunkOfData
245262
{
246-
NSUInteger amount2Write = [self.peripheral maximumWriteValueLengthForType:self.writeWithResponse ? CBCharacteristicWriteWithResponse : CBCharacteristicWriteWithoutResponse];
247-
263+
NSAssert(0 != _dataWriteSize, @"Invalid write size");
248264
range.length = dataToWrite.length - range.location;
249-
if (range.length > amount2Write)
265+
if (range.length > _dataWriteSize)
250266
{
251-
range.length = amount2Write;
267+
range.length = _dataWriteSize;
252268
}
253269
[peripheral writeValue:[dataToWrite subdataWithRange:range] forCharacteristic:perRXchar type: self.writeWithResponse ? CBCharacteristicWriteWithResponse : CBCharacteristicWriteWithoutResponse];
254270
range.location += range.length;

0 commit comments

Comments
 (0)