Giter Site home page Giter Site logo

bean-ios-osx-sdk's People

Contributors

ckellerpunchthrough avatar gwalker1228 avatar karelkalthoff avatar kevinmarx avatar marklarr avatar matthewchung74 avatar mcarland avatar miguelcma avatar mplewis avatar raykamp avatar sodastsai avatar zdrewptd avatar zekeshearer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bean-ios-osx-sdk's Issues

GattSerialTransport:__unloadOutgoingQueue has two crashes in it

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.

Notify of scratch value change

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.

Connect to Bean without rescanning

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?

Connection 'flaps' when Bean goes out of range and comes back into range

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

Support for Swift

Wha's the best way to use the SDK in a Swift project? Bridge header? use_frameworks! in Cocoapods? Another approach?
Thanks!

readRSSI does not work on iOS 8

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.

Very Long Connection Times on iPad Pro

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.

Lost sketchName after programArduino withRawHexImage

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

Project is missing PTDBleDevice.h

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.

Project does not build

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.

OCMock files are included in CocoaPods install

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 :)

`-[PTDBean readAccelerationAxes]` doesn't work well

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];
    }
}

Carthage support

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.