I pushed a new update to the market at the weekend.
It should hopefully fix a problem where Tracks2Miles would complain it could not access My Tracks data even when sharing was allowed. This looks to be down to a change in the My Tracks API with the My Tracks 1.1.15.
I’ve also tweaked the “Like” handling a little to only work for posts that are videos or pictures as this seams to be the only type of posts this works.
Recently a college has been having a look at the code to see if there are some things he wants to add. Hopefully I should have something from him soon.
We got a bunch of Touchatag NFC readers in the office just after Christmas and I said I would have a play with one to see what we could use them for. I had seen one before (in fact I borrowed one from Andy Piper for a little while) but didn’t get much further than trying to read my work id card.
To get it work on Linux you need to use PCSC Lite and download the driver from ASC (the guys that actually make the readers that Touchatag use). You can grab the download here. Once you’ve built these (standard “configure; make; sudo make install”) you will need to update one of the PCSC config files. There is a patch linked to from this page: http://idefix.net/~koos/rfid-touchatag.html
PCSC Lite is packaged for Fedora and Ubuntu, but I couldn’t find libnfc in the standard repos for Ubuntu so ended up building it myself for one of the machines in the office. Again this was a simple “configure; make; sudo make install”. With that done I was able to use the nfc-mfclassic tool from the libnfc samples to read data from a tag.
$ nfc-mfclassic r a test.out
Connected to NFC reader: ACS ACR122U 00 00 / ACR122U103 - PN532 v1.6 (0x07)
Found MIFARE Classic 4k card with UID: 9e2bcaea
Reading out 256 blocks |.....................................|
Which gets me a file with all the data stored on a tag (assuming I know the right keys to access all the blocks), but most of the time just having the tag id is enough to trigger an event. After a bit more poking around I found nfc-eventd which seamed to fit the bill perfectly.
This allows you to specify commands to be run when a tag is placed on the reader and when it is removed and it will pass the tag id to the command. Here is the config file I used
nfc-eventd {
# Run in background? Implies debug=false if true
daemon = false;
# show debug messages?
debug = true;
# polling time in seconds
polling_time = 1;
# expire time in seconds
# default = 0 ( no expire )
expire_time = 0;
device my_touchatag {
driver = "ACR122";
name = "ACS ACR 38U-CCID 01 00";
}
# which device to use ? note: if this part is commented out,
# nfc-eventd will try to pick up device automagically...
#nfc_device = "my_touchatag";
# list of events and actions
module nem_execute {
# Tag inserted
event tag_insert {
# what to do if an action fail?
# ignore : continue to next action
# return : end action sequence
# quit : end program
on_error = ignore ;
# You can enter several, comma-separated action entries
# they will be executed in turn
action = "publish 'wmqtt://nfc@broker:1883/nfc/tagid?qos=0&retain=n&debug=0' $TAG_UID"
}
# Tag has been removed
event tag_remove {
on_error = ignore;
action = "(echo -n 'Tag (uid=$TAG_UID) removed at: ' && date) >> /tmp/nfc-eventd.log";
}
# Too much time card removed
event expire_time {
on_error = ignore;
action = "/bin/false";
}
}
}
Here I have used the publish command from the IBM IA93 CMQTT package to publish a message with the tag id to the nfc topic. You can do something similar with mosquitto_pub like this:
mosquitto_pub -h broker -i nfc -t nfc -m $TAG_ID
The plan is to use this now to allow the guys in ETS to log into various demos in the lab with their id badges.
Next on the list is to see if I can get the reader to respond to my Galaxy Nexus when it’s in tag mode.
For a bit of fun round a project last year I created some Moo “MQTT Inside” stickers to put on the cases.
These became very popular around the office, with everybody wanting to label up their MQTT enabled projects and the first batch of 90 quickly disappeared.
Given demand was so high Andy Piper suggested it might be worth making it possible for others to order their own sets and pointed me at the Moo API.
The Moo API Doc is pretty good, but there aren’t any examples so it took a bit of trial and error. The API works by building up an object called a ‘pack‘. The Moo website uses the same API for the wizard you use to manually create any of their products and there is a very nice little Greasemonkey script called ‘Show API JSON’ which shows you the state of the pack object at each step. The API also lets you skip any steps in the process by just uploading a pack object already filled in. This meant I could reproduce the stickers by choosing to edit my original set and then using the script to save the pack.json file.
Resubmitting this with the ‘moo.pack.createPack‘ method and then using the ‘finish’ Drop in point to direct the user to Moo checkout page to pay for their new stickers.
I used a little library called scrib to do the oAuth and the whole thing can be done with just these few lines: