punchthrough / bean-ios-osx-sdk Goto Github PK
View Code? Open in Web Editor NEWPunch Through's SDK for speeding up development with the LightBlue Bean development platform
License: MIT License
Punch Through's SDK for speeding up development with the LightBlue Bean development platform
License: MIT License
Can you subscribe to be notified of scratch bank changes?
I've looked around – and the only option seems to request explicitly PTDBean.readScratchBank
, which means polling.
as title :(
It takes about 10 secs to make Serial I/O work. The message sent during the 10 secs waiting time is dropped too.
When doing an Arduino code update with programArduinoWithRawHexImage:andImageName:
, everything goes well (Bean is not bricked, and the sketch runs nicely) but once this is done, the Bean has lost all its sketch infos.
The symptom is that every subsequent call to readArduinoSketchInfo
leads to a [PTDBeanDelegate bean:didUpdateSketchName:dateProgrammed:crc32:]
where the name, date, and CRC32 are either null or empty :(
I should mention that if I program the Bean with the same sketch file from the CLI, then the [PTDBeanDelegate bean:didUpdateSketchName:dateProgrammed:crc32:]
displays nicely every information.
Is there any additional thing to do after programming the Arduino to ensure getting consistent sketch infos?
Using the PTDBean iOS SDK 3.0.2 and iOS 10.2
This question was also posted in Punchthrough's forum:
http://beantalk.punchthrough.com/t/lost-sketchname-after-programarduino-withrawheximage/4094?u=jba
Wha's the best way to use the SDK in a Swift project? Bridge header? use_frameworks!
in Cocoapods? Another approach?
Thanks!
With CoreBluetooth I can save peripheral identifier, and later – even after app restarts – can use that identifier to get CBPeripheral
in
let peripheral = centralManager.retrievePeripherals(withIdentifiers: [identifier]) .first!
Then proceed with the retrieved peripheral as usual:
centralManager.connect(peripheral, options: nil)
Here is a project demonstrating this: https://github.com/paiv/btpage
Currently this is not possible with PTDBeanManager
since every operation checks against internal list of beanRecords
discovered.
What is your suggested workaround for an app to store known peripheral identifier and then connect to that peripheral by its identifier?
Hi guys!
I'm getting the error message:
Property 'UUID' not found on object of type 'CBPeripheral
in file: CBPeripheral+UniqueId.m
I'm compiling in XCode 7 Beta2.
As mentioned by somebody else here: https://forums.developer.apple.com/thread/5941
This property is deprecated.
Please help! Thank you very much!
BaloMueller
I cannot get readRSSI to ever call PTDBeanDelegate:beanDidUpdateRSSI. According to Apple, the current implementation's use of CBPeripheralDelegate:peripheralDidUpdateRSSI:error has been deprecated in favor of CBPeripheralDelegate:peripheral:didReadRSSI:error. Although only marked as deprecated, on an iPhone 6 with iOS 8.0.2 it never worked for me.
The solution was to copy the body of PTDBleDevice:peripheralDidUpdateRSSI:error to a new method to match the didReadRSSI signature, and PTDBean:readRSSI works as expected now.
It seems like this is something that could be fixed in the next version of the SDK.
Thanks for your time.
I have found that if a Bean goes out of range while connected to a device and the device re-initiates a connection then when the device comes back into range, the connection will 'flap'. The bean disconnects with the didDisconnectBean: delegate method reporting -
Error: Error Domain=PTDBean Code=100 "Validation Failed. Retry count exceeded" UserInfo=0x17806bbc0 {NSLocalizedDescription=Validation Failed. Retry count exceeded} { NSLocalizedDescription = "Validation Failed. Retry count exceeded"; }
The bean then reconnects before disconnecting a short time later with the same message.
Increasing PROFILE_VALIDATION_RETRY_TIMEOUT
to 100.0f
in PTDBean.m
seems to resolve the issue
The PTDBean.m file references AppMessages.h and AppMessageTypes.h (and so does the XCode Project itself), but they don't seem to be included in the project. Thanks!
I'm using the iOS SDK to fetch both accelerometer and thermometer values.
The SDK usually returns those sensor values correctly (via the delegate methods). And the console log seems well too.
2015-04-30 11:00:28.749 lbbean[3297:942563] App Message Received: MSG_ID_CC_ACCEL_READ: <ebff1d00 f90002>
2015-04-30 11:00:28.777 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:28.928 lbbean[3297:942563] App Message Received: MSG_ID_CC_ACCEL_READ: <e7ff2100 f70002>
2015-04-30 11:00:29.017 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:29.168 lbbean[3297:942563] App Message Received: MSG_ID_CC_ACCEL_READ: <e6ff2100 f80002>
2015-04-30 11:00:29.288 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:29.378 lbbean[3297:942563] App Message Received: MSG_ID_CC_ACCEL_READ: <e8ff1d00 f80002>
2015-04-30 11:00:29.467 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:29.618 lbbean[3297:942563] App Message Received: MSG_ID_CC_ACCEL_READ: <e8ff1c00 000102>
2015-04-30 11:00:29.707 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
But sometimes, usually after re-connecting to the bean (connect first and then disconnect repeatedly), the bean doesn't report any update about the accelerometer. It only reports the thermometer's, like following.
2015-04-30 11:00:21.677 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:21.767 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:21.858 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:21.948 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:22.038 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:22.128 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:22.219 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
2015-04-30 11:00:22.308 lbbean[3297:942563] App Message Received: MSG_ID_CC_TEMP_READ: <1c>
The way I used to keep updating the sensor values is like following:
- (void)bean:(PTDBean *)bean didUpdateAccelerationAxes:(PTDAcceleration)acceleration {
// ... other code ...
if (bean.state == BeanState_ConnectedAndValidated) {
[bean readAccelerationAxes];
}
}
Domain: PTDBeanManager, Code: 5
"Attemp to connect to Bean failed." // should be "Attempt"
A fresh version of this project opened in Xcode 7.0 (not beta) does not build.
Error message: "AppMessages.h" file not found.
AppMessageTypes.h is also missing from the project.
Installing via CocoaPods in a new Swift project fails with this error:
/Projects/BeanOCMock/Pods/Bean-iOS-OSX-SDK/Bean OSX Static Library/Frameworks/OCMock.framework/Headers/OCMock.h:17:9: 'OCMock/OCMockObject.h' file not found
(see also #24, specifically this comment
I'm using XCode 8 in a Swift project. See minimal example here: https://github.com/wasnotrice/BeanOCMockExample
After installing via CocoaPods, I see
$ tree Pods/Bean-iOS-OSX-SDK/Bean\ OSX\ Static\ Library/Frameworks
Pods/Bean-iOS-OSX-SDK/Bean\ OSX\ Static\ Library/Frameworks
├── OCMock
│ └── OSX
│ └── OCMock.framework
│ └── Versions
│ └── A
│ └── Headers
│ ├── NSNotificationCenter+OCMAdditions.h
│ ├── OCMArg.h
│ ├── OCMConstraint.h
│ ├── OCMLocation.h
│ ├── OCMMacroState.h
│ ├── OCMRecorder.h
│ ├── OCMStubRecorder.h
│ ├── OCMock.h
│ └── OCMockObject.h
└── OCMock.framework
├── Headers
│ ├── NSNotificationCenter+OCMAdditions.h
│ ├── OCMArg.h
│ ├── OCMConstraint.h
│ ├── OCMLocation.h
│ ├── OCMMacroState.h
│ ├── OCMRecorder.h
│ ├── OCMStubRecorder.h
│ ├── OCMock.h
│ └── OCMockObject.h
└── Versions
├── A
│ └── Headers
│ ├── NSNotificationCenter+OCMAdditions.h
│ ├── OCMArg.h
│ ├── OCMConstraint.h
│ ├── OCMLocation.h
│ ├── OCMMacroState.h
│ ├── OCMRecorder.h
│ ├── OCMStubRecorder.h
│ ├── OCMock.h
│ └── OCMockObject.h
└── Current
└── Headers
├── NSNotificationCenter+OCMAdditions.h
├── OCMArg.h
├── OCMConstraint.h
├── OCMLocation.h
├── OCMMacroState.h
├── OCMRecorder.h
├── OCMStubRecorder.h
├── OCMock.h
└── OCMockObject.h
13 directories, 36 files
Workaround: manually remove the OCMock files and the related lines inBean-iOS-OSX-SDK-umbrella.h
I've tried to update the Podfile, but I haven't yet found the proper incantation to exclude OCMock, so for now, this is just a report :)
I've tried to build the SDK with Carthage by adding the following line to Cartfile:
github "PunchThrough/Bean-iOS-OSX-SDK" ~>3.0
but this ends with an error:
>>> carthage update Bean-iOS-OSX-SDK
*** Cloning Bean-iOS-OSX-SDK
*** Fetching PromiseKit
*** Checking out Bean-iOS-OSX-SDK at "3.0.0"
*** xcodebuild output can be found in /var/folders/x9/_m8tmjpx2d3f8wrlnb1r43jr0000gn/T/carthage-xcodebuild.zMPLcQ.log
*** Skipped building Bean-iOS-OSX-SDK due to the error:
Dependency "Bean-iOS-OSX-SDK" has no shared framework schemes
If you believe this to be an error, please file an issue with the maintainers at https://github.com/PunchThrough/Bean-iOS-OSX-SDK/issues/new
I recently checking out the branch and tried to build it but am getting a failure saying PTDBleDevice.h is missing. I don't see it in the source folder anywhere.
First, line 57:
if(gattTransport && gattPacketTxQueue)
It's not sufficient just to check if gattPacketTxQueue is non-nil, because the block will call [gattPacketTxQueue objectAtIndex:0] and in this case, somehow the queue is empty. A safer approach would be to check gattPacketTxQueue != nil && gattPacketTxQueue.count > 0 for the block.
Second, line 78:
[gattPacketTxQueue removeObjectAtIndex:0];
Same issue, queue is non-nil but has no objects.
As to why the queue ends up in this state, I cannot say. This is a crash I've come across multiple times, mostly when the bean goes out of range. I've made the fixes locally to keep moving, but it might be something to review for the next SDK version.
Thanks for your time.
When trying to connect to a bean on the iPad pro I'm seeing VERY long connect times. As in 3-4 minutes. On iPhone it is an instant connection. This did not used to happen until I updated the SDK. I have the pod file using the latest version of the SDK (3.0.6 I believe).
UPDATE: This is not an issue on 3.0.1 and starts happening right after any update. If you are having connectivity issues on iPad connectivity then I suggest installing pod 'Bean-iOS-OSX-SDK', '3.0.1'
You can see my example code here:
//
// ViewController.m
// Test
//
// Created by David Nelson on 9/1/17.
// Copyright © 2017 Duffek Mobile. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic, retain) PTDBeanManager *beanManager;
@property (nonatomic, retain) PTDBean *testBean;
@property (weak, nonatomic) IBOutlet UILabel *beanLabel;
@end
@implementation ViewController
@synthesize beanManager, testBean, beanLabel;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
beanManager = [[PTDBeanManager alloc] initWithDelegate:self];
}
#pragma mark - BeanManagerDelegate Callbacks
- (void) beanManager:(PTDBeanManager *)beanManager didDiscoverBean:(PTDBean *)bean error:(NSError *)error
{
NSLog(@"Discovered a bean: %@ id: %@", bean.name, bean.identifier.UUIDString);
testBean = bean;
[beanLabel setText:[NSString stringWithFormat:@"Bean Name: %@", testBean.name]];
if (error)
{
NSLog(@"Error discovering bean: %@", [error description]);
return;
}
}
- (void)beanManagerDidUpdateState:(PTDBeanManager *)manager
{
if(manager.state == BeanManagerState_PoweredOn)
{
// if we're on, scan for advertisting beans
NSError* scanError;
[manager startScanningForBeans_error:&scanError];
if (scanError)
{
NSLog(@"%@", [scanError localizedDescription]);
}
}
else if (manager.state == BeanManagerState_PoweredOff)
{
return;
}
}
-(void) beanManager:(PTDBeanManager *) beanManager didConnectBean:(PTDBean *)bean error:(NSError *)error
{
NSLog(@"Did connect called!");
if (error)
{
NSLog(@"Did connect error: %@", error.localizedDescription);
return;
}
}
-(void) beanManager:(PTDBeanManager *)beanManager didDisconnectBean:(PTDBean *)bean error:(NSError *)error
{
NSLog(@"Disconnected...");
}
- (IBAction)testPressed:(id)sender {
NSLog(@"Trying to connect to: %@", testBean.name);
NSError *error;
[beanManager connectToBean:testBean error:&error];
if (error != nil) {
NSLog(@"error: %@", error.localizedDescription);
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Verified on iPhone that it connects. iPad it hangs for about 5-6 minutes before it will connect.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.