Comments (7)
Hi, many thanks for the report.
I'm very sorry for now I have only tested this framework on Ubuntu 14.04 and 14.10. Due to the dependencies of native bindings in the BLE stack, currently on Ubuntu this framework only support node v0.10.x. I've used v0.10.40 for my testing.
OTOH, could you open a console and post the output of below command here?
curl -H "Content-Type: application/json" -X POST http://<gateway_ip_address>:3049/discover
Here gateway_ip_address should be the IP address of the machine running this framework
Also, for now the test cases run by 'npm test' do not support calling ONVIF device actions due to lack of token support, I'll add this support soon. Sorry for the inconvenience.
from cdif.
$ curl -H "Content-Type: application/json" -X POST http://localhost:3049/discover
$ OK
Same message with IP and localhost
from cdif.
Still get a 404 with /discover though. I will try downgrading to 0.10.4 and see what happens
from cdif.
nope, downgrading give the same 404.
from cdif.
I think the reason you get OK from curl but 404 from browser is because this call requires HTTP POST method. Normally when you paste a URL in browser address bar it will issue HTTP GET method, so it will return 404 in this case. After issue the above curl command, you may test if any device is found by issue below curl command:
curl -H "Content-Type: application/json" -X GET http://localhost:3049/device-list
If any device is found, its information will be returned in HTTP response body in JSON format. The discovered device is indexed by its deviceID in uuid form. Taking TI sensorTag as the example, the output would be something like
{"a540d490-c3ab-4a46-98a9-c4a0f074f4d7":{"configId":1,"specVersion":{"major":1,"minor":0},"device":{"deviceType":"urn:cdif-net:device:SensorHub:1","friendlyName":"SensorTag 2.0","manufacturer":"Texas Instruments","manufacturerURL":"www.ti.com/sensortag","modelDescription":"CC2650 SensorTag","modelName":"CC2650 SensorTag","userAuth":false,"iconList":[{"mimetype":"image/format","width":80,"height":100,"depth":16,"url":"icon URL"}],"serviceList":{}}}}
Subsequently, you need to stop the discover process:
curl -H "Content-Type: application/json" -X POST http://localhost:3049/stop-discover
And next, you may connect to the device by issue below command:
curl -H "Content-Type: application/json" -X POST http://localhost:3049/device-control/a540d490-c3ab-4a46-98a9-c4a0f074f4d7/connect
Then, you may read illuminance sensor value from command line:
curl -H "Content-Type: application/json" -X POST -d '{"serviceID":"urn:cdif-net:serviceID:Illuminance","actionName":"getIlluminanceData","argumentList":{"illuminance":0}} ' http://localhost:3049/device-control/a540d490-c3ab-4a46-98a9-c4a0f074f4d7/invoke-action
I'm sorry this looks a little bit tedious but the current goal of this framework is to provide a common IoT device API interface for client web apps, but not directly return HTML contents to be accessible in browser. Browser or other standalone web apps may invoke JQuery Ajax API or other ways to be able to flexibly visit this interface.
I'll update the README.md file about the above example usage. Please let me know if this is helpful for your case.
from cdif.
Ok, that was my issue, I didn't realize I had to POST to discover.
curl -H "Content-Type: application/json" -X POST http://localhost:3049/discover
returns OK.
As I have no devices to connect to atm, i will test at a later date; Thank you for your time helping me out on this.
from cdif.
Thank you for your efforts on my project. The reason I chose POST is because it might alter the framework's internal status. While GET calls should not.
from cdif.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdif.