Developing apps for TI SensorTag made easy

Discuss the company and its products.
paul_tanner
Posts: 6
Joined: 08:19, 31 Oct 2014

Developing apps for TI SensorTag made easy

Postby paul_tanner » 09:34, 31 Oct 2014

Evothings looks great so I got stuck in using this README
https://github.com/divineprog/evo-demos ... ISensorTag

Running the included apps worked fine but I the whole idea was to be able to roll my own. The 2 approaches I tried failed. This may be my wrong reading of the instructions or maybe they are no longer correct?

1. Running the app using Evothings Studio

"Drag and drop index.html into the Evothings Workbench running on your computer"
I have the workbench running but it has no drop area so what do you mean by "into the Workbench"

2. Drag and drop index.html into the Evothings Workbench running on your computer

I already use cordova so I thought this would be simple
the link to "Evothings Build Doc" is broken
so I did:

cordova create
moved in the index.html from the above example
added ble.js and ti-sensortag.js and referenced them from index.html
cordova build
adb install

This gave me a running app but a completely static one (none of the javascript executing and nothing on adb logcat).

Looking at the code I do not see why it doesn't start. Maybe there was something in the "Build Doc" that I need to do.

3. Modifying the included examples

Did not see anything to explain how to copy and modify the examples and have the modified one executable from the studio.

Any suggestions appreciated. Thx. Paul

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Developing apps for TI SensorTag made easy

Postby micke » 11:20, 04 Nov 2014

Hi Paul,

Thanks for reporting unclear documentation. Here is an attempt to clarify.

Dragging HTML files into Evothings Workbench

You can drag and drop HTML files anywhere in the project list window of the Workbench. This will make the new file appear as the first item in the list. (Items can be rearranged by dray & drop, to remove an item click the X-icon.) A "project" is just an HTML file (with any associated files in the same folder or subfolders).

Building an app with Cordova

Here is the correct link to the documentation for how to build apps with Cordova:
http://evothings.com/doc/build/build-overview.html

What you need to do is to install the cordova-ble plugin:
https://github.com/evothings/cordova-ble

Add it to the Cordova project like this:

Code: Select all

cordova plugin add https://github.com/evothings/cordova-ble


The file "ble.js" is included automatically with the plugin, and built with the Cordova project.

Modifying the included examples

The examples are just ordinary folders. Click "CODE" in the Workbench to open the folder for a project. You can then go to the parent folder, copy the folder, and drag the index.html file into the Workbench. You then have a copy of the project.

Let me know how it goes, there is sure a lot that could be done to clarify the above in the documentation. Any suggestions are welcome!

Updated links/instructions in this file to make it a bit clearer:
https://github.com/divineprog/evo-demos ... ISensorTag

There is also an official blogpost for the example:
http://evothings.com/quick-guide-to-mak ... avascript/

Very best regards, Mikael

paul_tanner
Posts: 6
Joined: 08:19, 31 Oct 2014

Re: Developing apps for TI SensorTag made easy

Postby paul_tanner » 14:31, 04 Nov 2014

Thx Micke,

Trying via the Studio worked for me this time around and a visible drop area presented itself.

Similarly, copying an example, editing the title and h1 tags then dropiing it in worked fine.

Not sure why I could not do this before but many thanks for what looks like a really great tool for learning BLE.

Trying the native build again. Thx for the link. However, there seems to be an issue with including your plugin from github.

$ cordova plugin add https://github.com/evothings/cordova-ble
Fetching plugin "https://github.com/evothings/cordova-ble" via git clone
Error: Command failed: error: The requested URL returned error: 403 Forbidden while accessing https://github.com/evothings/cordova-ble/info/refs

fatal: HTTP request failed

at ChildProcess.exithandler (child_process.js:647:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)

(checked there's no connectivity problem to github.)
could not get it via plugin registry either (but you didn't suggest that anyway).

Any suggestions pls?
Regards, Paul

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Developing apps for TI SensorTag made easy

Postby micke » 14:46, 04 Nov 2014

Hi Paul,

Great to hear it works better now!

Try to clone or download the cordova-ble repo to your machine. For example, if you put it in a directory next to your Cordova app, that is, assuming this directory structure:

Code: Select all

some-parent-dirctory
    cordova-ble
    my-cordova-app


You could add the plugin like this:

Code: Select all

cd my-cordova-app
cordova plugin add ../cordova-ble


Does this work?

Not sure why installing directly from GitHub did not work. I just tested it today when I wrote the previous post. Looks like an access rights issue (I was authenticated on GitHub when testing).

Wonder if it would work to add ".git" to the GItHub URL? Like this:

Code: Select all

cordova plugin add https://github.com/evothings/cordova-ble.git


Very best, Mikael

paul_tanner
Posts: 6
Joined: 08:19, 31 Oct 2014

Re: Developing apps for TI SensorTag made easy

Postby paul_tanner » 16:53, 04 Nov 2014

Thx Mikael,

Got the plugin installed by downloading first.
Created a new cordova project to avoid any history.
Next error is this from cordova build android

BUILD FAILED
/opt/android-sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:698: null returned: 1

Total time: 8 seconds

/Users/paul_tanner/../sensortagevo/platforms/android/cordova/node_modules/q/q.js:126
throw e; ^
Error code 1 for command: ant with args: debug,-f,/Users/paul_tanner/../sensortagevo/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /Users/paul_tanner/Google Drive/Buggy Air Sensor/sensortagevo/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)

My other cordova android builds are ok so it's something about this one.

Regards, Paul

paul_tanner
Posts: 6
Joined: 08:19, 31 Oct 2014

Re: Developing apps for TI SensorTag made easy

Postby paul_tanner » 10:06, 05 Nov 2014

A bit more evidence...

If I follow your instructions exactly

cordova create DemoProject com.evothings.demoapp DemoApp
cd DemoProject
cordova platform add android
cordova build android

It works fine.

If I then replace the www folder with the one from your ti sensor tag example and add the ble plugin (downloaded from your git repo) I get the above build failure.
Also added the other 3 plugins you mentioned in the notes. Same effect.

Strange indeed.

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Developing apps for TI SensorTag made easy

Postby micke » 11:06, 12 Nov 2014

Hi Paul,

It is hard to tell what goes wrong. There can be many reasons, perhaps the Android SDK version and/or Cordova version are not compatible?

I created a project and tested the build steps. Using Cordova 3.6 to build and a recent Android SDK.

Tested on a Nexus 7 model 2013. You can download the project here:

http://evomedia.evothings.com/download/ ... roject.zip

It is prebuilt, but you can test the steps outlined in the README.md file and see if it works on your machine.

To build and install use:

cordova build android
adb install -r platforms/android/ant-build/DemoApp-debug.apk

Best regards, Mikael

User avatar
micke
Posts: 256
Joined: 20:49, 18 Nov 2013

Re: Developing apps for TI SensorTag made easy

Postby micke » 13:16, 12 Nov 2014

Hi again,

Just realized you can add the BLE plugin by referring to the name in the plugin registry, like this:

cordova plugin add com.evothings.ble

That might be easier/quicker than getting the code from GitHub.

Best, Mikael


Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 2 guests