diff options
author | Jonas Smedegaard <dr@jones.dk> | 2011-05-02 01:18:31 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2011-05-02 01:18:31 +0200 |
commit | 610799bc2c2365a1bd2afba4ae2c11c1acb613b1 (patch) | |
tree | 46bd8e49fe898372835836e590dcc80b785f4589 /msg/gateway.mdwn | |
parent | 4105fd6355caf520d87e9b6efa71c8d9cb5f9e6a (diff) |
Add initial msg pages.
Diffstat (limited to 'msg/gateway.mdwn')
-rw-r--r-- | msg/gateway.mdwn | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/msg/gateway.mdwn b/msg/gateway.mdwn new file mode 100644 index 0000000..8cb979a --- /dev/null +++ b/msg/gateway.mdwn @@ -0,0 +1,145 @@ +# Building a remote-control for real cars + +[[!meta date="2011-05-01"]] +[[!tag debian msg blog editorial]] + +## SMS is used to lock car doors + +[Copenhagen Carpool][] soon receive a new batch of electric cars. +The new cars will contain a cellphone tied to the door locks, +to only let into the car the member who booked its current timeslot. + +I am setting up the system to connect the cars with their booking calendar. + +The general idea is to... + + 1. Connect a standard cellphone to a computer. + 1. Forward sms messages received on the phone to the calendar. + 1. Send messages from the calendar through the phone. + 1. Leave the system in a corner, turned on 24/7. + +[[!graph src=""" +rankdir=LR +phone -> computer -> "calendar" [dir="both"]; +"""]] + +Most of my work is in trying to avoid ways things might go wrong +-- which so often happens when computers are involved. + +What if... + * messages are delayed or lost? + * a chain of messages arrive out of order? + * messages are sent faster than they can be delivered? + +[Copenhagen Carpool]: http://www.kobenhavnsdelebiler.dk/ + "Københavns Delebiler" + + +## Reliable conversation + +Human conversation is most reliable when using plain speak. +Slang, sarcasm or jokes raise the risk of misunderstandings. +This is quite similar in computer conversation. + +When surfing the Web, +you normally "GET" a web page or "POST" new data like a search query. +The words "GET" and "POST" are "plain speak" of the World Wide Web +-- defined as a principle called "[REST][]" or "RESTful design". + +[[!graph src=""" +rankdir=LR +"fetch document" -> website [label="GET", dir="back"]; +"provide info" -> website [label="POST"]; +"""]] + +I use the [Kannel][] tool to talk directly to the phones. +When an sms arrives on the phone, +Kannel "GET"s it to the calendar. +That's weakly expressed +-- better if it had "POST"ed the message instead. + +[[!graph src=""" +rankdir=LR +"provide sms info" -> "calendar" [label="GET" style="dotted"]; +"""]] + +Kannel is a quite reliable tool, but not RESTful in conversations. +That requires extra attention at other parts of the setup +to avoid breakage in special situations. + +That worries me. + +[Kannel]: http://www.kannel.org/ + "Kannel: Open Source WAP and SMS Gateway" + +[REST]: http://en.wikipedia.org/wiki/REST + "Representational State Transfer" + + +## Each car has a blog + +So I setup a gateway from Kannel to RESTful conversation. +And choose classic blogging as style of conversation: + + * The carpool fleet is a blogroll + * each car has a blog + * each sms emitted from a car is a blog entry + +Blogging comes in two flavors, +-- [RSS][] and [Atom][]. +Both cover distribution of messages. +I use Atom because it is newest and coolest, +and because it also covers creating and editing meesages +with the [AtomPub][] extension. + +AtomPub allows the calendar to create an empty message +-- which then triggers an sms from the car which "fills it in." + +AtomPub also let the calendar "PUT" tags onto existing messages, +to mark them as processed, read etc., +and let an admin or a cleanup script "DELETE" outdated entries or blogs. +The words "PUT" and "DELETE" are RESTful conversation as well. + +[Atom]: http://en.wikipedia.org/wiki/Atom + "Atom" + +[RSS]: http://en.wikipedia.org/wiki/RSS + "RSS" + +[AtomPub]: http://en.wikipedia.org/wiki/AtomPub + "AtomPub" + + +## The system is dancing! + +My sms-to-blog gateway is written in [Perl][], +using the [Dancer][] toolkit. + +Dancer makes it simple to setup a RESTful web conversation, +and when I contacted the authors on [IRC][], +they swiftly added support for the non-RESTful quirk that I needed. + +[[!graph src=""" +rankdir=LR +phone -> "sms gateway" [dir="both"]; +"sms gateway" -> "blog gateway" [dir="both", style="dotted"]; +"blog gateway" -> calendar [dir="both"]; +"""]] + +My sms-to-blog gateway is not yet ready, but basic routines work. +The [project is public][], and code is [Free Software][]. + +[Perl]: http://en.wikipedia.org/wiki/Perl + "Perl" + +[Dancer]: http://www.perldancer.org/ + "Dancer: Perl web development framework" + +[IRC]: http://www.perldancer.org/irc + "IRC Chat system (Internet Relay Chat)" + +[project is public]: git://source.delebilfonden.dk/msg/ + "Kannel-to-AtomPub Gateway" + +[Free Software]: http://www.debian.org/social_contract#guidelines + "The Debian Free Software Guidelines (DFSG)" |