GithubHelp home page GithubHelp logo

Comments (10)

jacobrosenthal avatar jacobrosenthal commented on July 28, 2024

For more background, I can request state in an noblebindings.init, but it arrives before the component is created..

2015-10-01 13:31:21.200 [info][tid:com.facebook.React.JavaScript] 'calling RNBLE.getState'
2015-10-01 13:31:21.210 [info][tid:com.facebook.React.RNBLEQueue][RNBLE.m:61] getState
2015-10-01 13:31:21.233 [info][tid:com.facebook.React.JavaScript] 'stateChange poweredOn'
2015-10-01 13:31:21.236 [info][tid:com.facebook.React.JavaScript] 'Running application "BabelES6" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF'
2015-10-01 13:31:21.282 [warn][tid:com.facebook.React.JavaScript] 'devtools socket errored', [Error: The operation couldn’t be completed. Connection refused]
2015-10-01 13:31:21.334 [info][tid:com.facebook.React.JavaScript] 'peripheral discovered (7338CDAA-609D-F579-53C6-DCD965D11483 with address <unknown, unknown>, connectable true, RSSI -68:'

from react-native-ble.

sandeepmistry avatar sandeepmistry commented on July 28, 2024

@jacobrosenthal I've removed the bindings self "init"ing themselves pattern from noble and bleno. Now init gets called externally in the Noble or Bleno constructor:

from react-native-ble.

jacobrosenthal avatar jacobrosenthal commented on July 28, 2024

Ill give it a shot today!

On Sat, Oct 3, 2015 at 6:30 PM, Sandeep Mistry [email protected]
wrote:

Noble

from react-native-ble.

jacobrosenthal avatar jacobrosenthal commented on July 28, 2024

Fixed in v0.0.5 Thanks!

from react-native-ble.

jacobrosenthal avatar jacobrosenthal commented on July 28, 2024

This is back again since I upgraded rn
https://github.com/jacobrosenthal/react-native-ble/blob/master/examples/BabelES6/index.ios.js#L18

from react-native-ble.

jacobrosenthal avatar jacobrosenthal commented on July 28, 2024

Using a super shitty hack to fix this for the moment.
e96a34f

Better ideas accepted

from react-native-ble.

rclai avatar rclai commented on July 28, 2024

We may need to consider the case that in a mobile app, even though there is Bluetooth functionality, you may never use it unless you hit a particular scene via the Navigator component. You may hit a scene where you want to search for stuff, and then all of a sudden cancel out of it, and then later on want to go back to it again. If I'm not mistaken, the current noble pattern seems to indicate that you get to catch that Bluetooth state once and only in the beginning of the app's runtime. In a mobile app, I think you need to have the ability to request the Bluetooth state on-demand given the scenarios that I stated above. I think the noble library needs to have a getState method that a custom bindings needs to implement. For example,

// noble.js
noble.prototype.getState = function(callback) {
  if (callback) {
    this.once('stateChange', callback);
  }
  this._bindings.getState();
};

// bindings.ios.js
nobleBindings.getState = function() {
  // Calls the native module (we have it already)
  RNBLE.getState();
};

Thoughts?

from react-native-ble.

jacobrosenthal avatar jacobrosenthal commented on July 28, 2024

I dont think it should be needed. noble.state is updated as the os emits the state changes.

from react-native-ble.

rclai avatar rclai commented on July 28, 2024

I thought you didn't want to depend on that state property to start Bluetooth operations.

from react-native-ble.

jacobrosenthal avatar jacobrosenthal commented on July 28, 2024

Were talking about 2 separate issues. A lot of existing code just waits for
a state change to do anything. We were always losing this initial state
change, and I wanted to support that existing code out of the box.

Secondly, yes you may check and or poll noble.state if you like.

On Sun, May 1, 2016 at 8:22 PM, Richard Lai [email protected]
wrote:

I thought you didn't want to depend on that state property to start
Bluetooth operations.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#1 (comment)

from react-native-ble.

Related Issues (20)

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.