chickadee is a contextual associations store. Specifically, it associates wireless device identifiers with a URL and/or a tag. In other words it maintains, for instance, the link between your wireless device and your online stories so that Smart Spaces which detect your device can understand what you're sharing about yourself. It also allows logical groupings of devices to share a common tag such as "lounge", for instance, to represent the sensor devices in a lounge, and "friends", for instance, to represent the devices carried by a group of friends.
chickadee is also a contextual API for the IoT. It binds to an instance of barnacles which provides the current state. It supports queries regarding the context at or near either a device ID or a tag. Continuing with the example above, it supports queries such as what is the contextat the lounge, as well as what is the contextnear the friends.
The barnowl, barnacles, barterer and chickadee packages all work together as a unit, conveniently bundled as hlc-server. Check out our developer page for more resources on reelyActive software and hardware.
The Cornell Lab of Ornithology explains: "The Black-Capped Chickadee hides seeds and other food items to eat later. Each item is placed in a different spot and the chickadee can remember thousands of hiding places." Not only does it have an outstanding associative memory, it is also "almost universally considered cute thanks to its oversized round head, tiny body, and curiosity about everything, including humans."
If you were entrusting a bird to associate your wireless device with your online stories you'd want it to be cute and friendly enough to eat out of your hand, right? We could have named this package Clark's Nutcracker, the bird with arguably the best associative memory, but the whole nut-cracking thing doesn't inspire the same level of friendliness now does it?
One more fun fact that we feel compelled to pass along: "Every autumn Black-capped Chickadees allow brain neurons containing old information to die, replacing them with new neurons so they can adapt to changes in their social flocks and environment even with their tiny brains." Wow, that's database efficiency that we can aspire to!
npm install chickadee
var chickadee = require('chickadee');
var barnacles = require('barnacles');
var barnowl = require('barnowl');
var associations = new chickadee();
var notifications = new barnacles();
var middleware = new barnowl();
middleware.bind( { protocol: 'test', path: 'default' } );
notifications.bind( { barnowl: middleware } );
associations.bind( { barnacles: notifications } );When the above is run, you can query the contextat a given (receiving) device, and the contextnear a given (transmitting) device:
- http://localhost:3004/contextat/receiver/001bc50940800000
- http://localhost:3004/contextnear/transmitter/fee150bada55
A test tag is provided by default for the four simulated test reelceivers, present when barnowl is bound to the test protocol, and can be queried at http://localhost:3004/contextat/tags/test.
Include Content-Type: application/json in the header of all interactions in which JSON is sent to chickadee.
Retrieve the context at the given receiver device id. For example, the id 001bc50940800000 would be queried as GET /contextat/receiver/001bc50940800000 and might return:
{
"_meta": {
"message": "ok",
"statusCode": 200
},
"_links": {
"self": {
"href": "http://localhost:3004/contextat/receiver/001bc50940800000"
}
},
"devices": {
"001bc50940100000": {
"url": "http://reelyactive.com/metadata/test.json",
"nearest": [
{
"device": "001bc50940800000",
"rssi": 144
}
],
"href": "http://localhost:3004/associations/001bc50940100000"
},
"001bc50940800000": {
"url": "http://reelyactive.com/metadata/ra-rxxx.json",
"href": "http://localhost:3004/associations/001bc50940800000"
}
}
}
Retrieve the context at the given directory value. For example, the directory forest:tree would be queried as GET /contextat/directory/forest:tree and would return data with the same structure as the above.
Retrieve the context at the given tags. For example, the tag test would be queried as GET /contextat/tags/test and would return data with the same structure as the above.
Retrieve the context near the given transmitter device id. For example, the id 001bc50940100000 would be queried as GET /contextnear/transmitter/001bc50940100000 and might return:
{
"_meta": {
"message": "ok",
"statusCode": 200
},
"_links": {
"self": {
"href": "http://localhost:3004/contextnear/transmitter/001bc50940100000"
}
},
"devices": {
"001bc50940100000": {
"url": "http://reelyactive.com/metadata/test.json",
"nearest": [
{
"device": "001bc50940800000",
"rssi": 133
}
],
"href": "http://localhost:3004/associations/001bc50940100000"
},
"001bc50940800000": {
"url": "http://reelyactive.com/metadata/ra-rxxx.json",
"href": "http://localhost:3004/associations/001bc50940800000"
}
}
}
Retrieve the context near the given tags. For example, the tag test would be queried as GET /contextnear/tags/test and would return data with the same structure as the above.
Retrieve the association for the device with the given id. For example the id 001bc50940800000 would be queried as GET /associations/001bc50940800000 and might return:
{
"_meta": {
"message": "ok",
"statusCode": 200
},
"_links": {
"self": {
"href": "http://localhost:3004/associations/001bc50940800000"
}
},
"devices": {
"001bc50940800000": {
"url": "http://myjson.info/story/test",
"directory": "forest:tree",
"tags": [
"birdnest"
],
"href": "http://localhost:3004/associations/001bc50940800000"
}
}
}
Update or create an association for the given device id. For example, to update a device with identifier 001bc50940800000, PUT /associations/001bc50940800000 and include the updated JSON, for example:
{ "url": "http://myjson.info/story/lonely",
"directory": "forest:tree:branch",
"tags": [ "birdnest", "home" ] }
A successful response might return:
{
"_meta": {
"message": "ok",
"statusCode": 200
},
"_links": {
"self": {
"href": "http://localhost:3004/associations/001bc50940800000"
}
},
"devices": {
"001bc50940800000": {
"url": "http://myjson.info/story/lonely",
"directory": "forest:tree:branch",
"tags": [
"birdnest",
"home"
],
"href": "http://localhost:3004/associations/001bc50940800000"
}
}
}
If the device id does not already exist, it will be created.
Delete a given device association.
Identical to GET /associations/id except that only the url, directory or tags is returned, respectively.
Identical to PUT /associations/id except that only the url, directory or tags is updated, respectively.
Identical to DELETE /associations/id except that only the url, directory or tags is deleted, respectively.
The following implicit associations are supported. In other words, the implicit url will be provided unless the device is already uniquely associated, via its identifier, with a url. If you're one of the manufacturers below and would like the URL to instead point to an API on your server please contact us.
- reelyActive Active RFID Tag (RA-T411)
- Identifier Type: EUI-64
- OUI-36: 001bc5094
- URL: http://reelyactive.com/metadata/ra-t411.json
- Product link
- reelyActive reelceiver (RA-Rxxx)
- Identifier Type: EUI-64
- OUI-36: 001bc5094
- URL: http://reelyactive.com/metadata/ra-rxxx.json
- Product link
- reelyActive Bluetooth Smart reelceiver (RA-R436)
- UUID: 7265656c794163746976652055554944
- URL: http://reelyactive.com/metadata/ra-r436.json
- Product link
- Fitbit
- UUID: adabfb006e7d4601bda2bffaa68956ba
- URL: http://reelyactive.com/metadata/fitbit.json
- Product link
- WNDR app
- UUID: 2f521f8c4d6f12269c600050e4c00067
- Product link
- Thalmic Labs Myo
- UUID: d5060001a904deb947482c7f4a124842
- URL: http://reelyactive.com/metadata/myo.json
- Product link
- Punch Through Design Bean
- UUID: a495ff10c5b14b44b5121370f02d74de
- URL: http://reelyactive.com/metadata/bean.json
- Product link
- August Smart Lock
- UUID: bd4ac6100b4511e38ffd0800200c9a66
- URL: http://reelyactive.com/metadata/august.json
- Product link
- Vanhawks Valour
- UUID: 9ac78e8d1e9943ce83637c1b1e003a10
- URL: http://reelyactive.com/metadata/vanhawks.json
- Product link
- Mightycast NEX Band
- UUID: f81e00015aa144bda4806ab7767d47e3
- URL: http://reelyactive.com/metadata/nexband.json
- Product link
- Jawbone
- UUID: 151c1000458041119ca15056f3454fbc
- URL: http://reelyactive.com/metadata/jawbone.json
- Product link
- Nexus Player
- UUID: cbbfe0e1f7f3420684e084cbb3d09dfc
- URL: http://reelyactive.com/metadata/nexusplayer.json
- Product link
- ENGAGE Technology Lock
- UUID: cbbfe0e1f7f3420684e084cbb3d09dfc
- URL: http://reelyactive.com/metadata/engage.json
- Product link
- TrackR
- UUID: 0f3e
- URL: http://reelyactive.com/metadata/trackr.json
- Product link
- Nod (OpenSpatial)
- UUID: febf
- URL: http://reelyactive.com/metadata/nod.json
- Product link
- Eddystone (Google)
- UUID: feaa
- URL: Parsed from service data, if of URL type
- Product link
- Physical Web (Google)
- UUID: fed8
- URL: Parsed from UriBeacon service data
- Product link
- Seed Labs
- UUID: fee6
- URL: http://reelyactive.com/metadata/seedlabs.json
- Product link
- Tencent
- UUID: fee7
- URL: http://reelyactive.com/metadata/tencent.json
- Tile
- UUID: feed
- URL: http://reelyactive.com/metadata/tile.json
- Product link
- Estimote beacon
- iBeacon UUID: b9407f30f5f8466eaff925556b57fe6d
- URL: http://reelyactive.com/metadata/estimote.json
- Product link
- Kontakt.io beacon
- iBeacon UUID: f7826da64fa24e988024bc5b71e0893e
- URL: http://reelyactive.com/metadata/kontakt.json
- Product link
- Roximity beacon
- iBeacon UUID: 8deefbb9f7384297804096668bb44281
- URL: http://reelyactive.com/metadata/roximity.json
- Product link
- Radius Networks beacon
- iBeacon UUID: 2f234454cf6d4a0fadf2f4911ba9ffa6
- URL: http://reelyactive.com/metadata/radiusnetworks.json
- Product link
- Orange beacon
- iBeacon UUID: 3d4f13b4d1fd404980e5d3edcc840b69
- URL: http://reelyactive.com/metadata/orangebeacon.json
- Product link
- Bright beacon
- iBeacon UUID: e2c56db5dffb48d2b060d0f5a71096e0
- URL: http://reelyactive.com/metadata/brightbeacon.json
- Product link
- LocosLab beacon
- iBeacon UUID: f0018b9b75094c31a9051a27d39c003c
- URL: http://reelyactive.com/metadata/locoslab.json
- Product link
- eNote beacon
- iBeacon UUID: dab59c4fa4d6ee286bfe8e0000bbc2bb
- URL: http://reelyactive.com/metadata/enote.json
- Product link
- Apple devices
- companyIdentifierCode: 004c
- URL: http://reelyactive.com/metadata/apple.json
- Gimbal devices
- companyIdentifierCode: 008c
- URL: http://reelyactive.com/metadata/gimbal.json
- Xiaomi devices
- companyIdentifierCode: 0157
- URL: http://reelyactive.com/metadata/xiaomi.json
- Curious devices (any SCAN_REQ)
- Bluetooth Smart devices (anything else which is Bluetooth Smart)
barnacles provides the current state. In the absence of a barnacles binding, chickadee will always return a 404 Not Found status. chickadee can bind to a single instance of barnacles only.
associations.bind( { barnacles: notifications } );The following options are supported when instantiating chickadee (those shown are the defaults):
{
httpPort: 3004,
associationManager: null,
persistentDataFolder: "data"
}
Notes:
- persistentDataFolder specifies the path to the folder which contains the persistent database file (before v0.3.12 the default was "")
This is an active work in progress. Expect regular changes and updates, as well as improved documentation! If you're developing with chickadee check out:
- diyActive our developer page
- our node-style-guide and angular-style-guide for development
- our contact information to get in touch if you'd like to contribute
MIT License
Copyright (c) 2015 reelyActive
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
