evothing.ble not initialized in evothings client app

Ask, and ye shall receive.
BambooJim
Posts: 1
Joined: 22:36, 02 Apr 2015

evothing.ble not initialized in evothings client app

Postby BambooJim » 23:21, 02 Apr 2015

This is a similar problem to viewtopic.php?f=12&t=145&hilit=ble+app -- TI Sensortag advertising and conversion periods

Basically, evothings.ble does not get initialzed -- however, it magically appears when a separate T.I. app activates the Bluetooth system on the iOS side.

Details ---
I have used your evothings app from iTunes to record data from a TI SensorTag. For our first Alpha test, we have decided to keep running with the evothings app as the "shell" for our app until we get proper device IDs to send to Apple so apple can "authorize" these iPad minis to download our real app. It's a purchasing issue -- can't get the iPad platform IDs until they are bought, and can't buy them until my client can check out the app. (way too much information, but ...)

Here is the problem: When I connect to my local server, (a node service built from Keystone), everything goes wonderful. The Keystone server sends index.html and app.js along with all the css and it all works fabulously. Everything is built with browserify, so the app.js is big and monolithic. The app.js does contain evothings.util, evothings.easyble, and evothings.tisensortag.

However, when I run the identical Keystone server on a system 5,000 miles away, the loading times are much longer. What happens is that my catch-try code results in the message "evothings.ble.stopscan" is undefined.

This occurs repeatedly, and the app never gets through the initialzation sequence. Since evothings.ble is cooked inside of the evothings client app, it is puzzling why it should come up undefined.

I tried the suggestion from the above mentioned "TI Sensortag advertising and conversion periods" posting which suggested that running the T.I. application to activate the BLE mechanism on the iPad seems to help.

That suggestion ALSO worked for this problem, although I don't think my corporate masters would appreciate this work-around.

So what can I do to make sure that evothings.ble gets initialized properly from the app.js?

This is the connection logic from the code in my app.coffee:

Code: Select all

initializeSensorTag = ->
  # Here sensors are set up.
  #
  # If you wish to use only one or a few sensors, just set up
  # the ones you wish to use.
  #
  # First parameter to sensor function is the callback function.
  # Several of the sensors take a millisecond update interval
  # as the second parameter.
  # Gyroscope takes the axes to enable as the third parameter:
  # 1 to enable X axis only, 2 to enable Y axis only, 3 = X and Y,
  # 4 = Z only, 5 = X and Z, 6 = Y and Z, 7 = X, Y and Z.
  #
  repeat = false
  failures =0
  try
    connected = false
    sensortag.statusCallback(statusHandler)
    sensortag.errorCallback(errorHandler)
#  sensortag.keypressCallback(keypressHandler)
    sensortag.accelerometerCallback(accelerometerHandler, 100)
    sensortag.magnetometerCallback(magnetometerHandler, 100)
    sensortag.gyroscopeCallback(gyroscopeHandler, 100, 7)
    sensortag.connectToClosestDevice()
  catch e
    failures++
    console.log "failed to initialize"
    console.log e
    # try again after 1/2 second
    repeat = window.setInterval(initializeSensorTag,500)
    return
  # when the try finishes without a catch, clear the retry timer
  if repeat?
    console.log "sensor came on-line after " + failures + " failures"
    window.clearInterval repeat
  else
    console.log "sensor came on-line immediately"
  return

Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 13 guests