Writing /var/www/timeinventorskabinet/public/wiki/data/meta/windclocks/tak.meta failed
 
Writing /var/www/timeinventorskabinet/public/wiki/data/meta/windclocks/tak.meta failed

TAK Server Overview


WARNING: TAK SERVER is being altered. All the Java stuff is out. Contact Balt for more info.

QuickStart

Getting a binary release of the takserver

  • tak is on tik.okno.be
  • You'll always find the latest server version at in /srv/takserver. Look for the file takserver.jar.
  • And this version should (will!) always be 100% compliant with the specifications you'll find below.

Installing the TAK Server dependencies

  • An install guide to TAK Server dependencies is available here: documentation (for Debian GNU/Linux).

Building TAK Server from sources

  • This is - shamefully - not possible at the moment with simple explanations (we are missing a artifact repository on a reliable server)… However, for enlightened hackers here:
    1. You can find the source code on the OKNO SVN repository.
    2. This code requires Apache Maven to build.
    3. You'll need to get the latest Smack API release (3.2.0 beta is fine)
      • The obviously tricky part: you'll have to mavenize the Smack JARs yourself (create a pom.xml file, SHA1 checksum files)
      • Waiting for the release of the 3.2.0 Smack API or a server running an artifact repository to simplify the build process.

Configuring the TAK Server

  • The TAK Server configurations is defined by two Java properties files. Java properties store configuration values with a simple set of key/value pairs.
  • Two default files are embedded in the TAKServer configuration:
    • takserver-default.properties
         log.file=log/takserver.log
         tak.port=30223
         tik.host=localhost
         tik.port=5222
         tik.pubsub=pubsub
       
  • takserver-dao.properties
         tak.dao.host=localhost
         tak.dao.user=root
         tak.dao.passwd=green
         tak.dao.schema=tak
       
  • These properties can be overridden by writing values to two user-defined files that should be located in the same directory as your takserver JAR:
    • takserver.properties: general configuration (general & XMPP server configuration) (overrides takserver-defaults.properties)
    • takdao.properties:persistence layer configuration (database) (overrides takdao-defaults.properties)
  • You can choose to overwrite only a subset of the default properties by setting only the desired key(s) in the desired file(s).
    • Example: should you want to override the log file location only and put logs in /var/log/takserver/takserver.log, simply create a takserver.properties file that will contain the following:
         log.file=/var/log/takserver/takserver.log
       

Starting up the TAK Server

  • Make sure your XMPP server and MySQL databases are running and configured correctly.
  • You'll have to lauch a terminal and change your current directory to the one containing the TAK Server jar, for instance, on walls.okno.be running Debian/GNU Linux:
       $> cd /srv/takserver
     
  • To start the server in debug mode and follow the complete log output from stdout, issue this command:
       $> java -classpath .:takserver.jar be.okno.tik.tak.server.Launcher
     
  • to invoke a background, terminal independent process and kill the stdout/stderr, issue this command instead:
       $> nohup java -classpath .:takserver.jar be.okno.tik.tak.server.Launcher > /dev/null & 
     

TIK JSON Protocol


How the WindClock should connect to the server:
1. Login as a clock

  • SO, you built you brand new windclock and connected it to an arduino. you can now log on the TAK server ! The story from the clock point of view :
  • “As a clock, I want to logon to the TAK server and start sending tiks”
    • To log on, send a Clock object to the server :
      • If you don't send a Clock object in the first place, the connection will be close without further ado
      • if there is any kind of connection close, if the clock reopens the connection, it must send a Clock object *again* as the first message to start sending Tiks.
  • The server will understand that, unless the connection comes to an end in any way, the clock will be sending only tiks after registering the Clock object you have sent.
  • Example Clock object in JSON :
    {"name":"esplanade","longitude":"2.17541","latitude":"48.809984","altitude":"0.0", "test":false}
  • make sure you take a unique name!
  • That means the new values you provide will override the existing ones in our database (to be discussed)
    • name (Java type:String, C type : char * terminated by \0)
    • longitude (Java type:Double, C type : double)
    • latitude (Java type:Double, C type : double
    • elevation (Java type:Double, C type : double)
  • NOTICE: for consistency stakes, avoid renaming your clock and setting it up somewhere else far away… It's gonna mix up the statistical computations and we/you don't wanna do that - unintentionally :)
  • If you want to use metadata, you have to add metaDataDefinitions. Your clock object will looksomething like this:
  •  {"name":"esplanade","longitude":0.0,"latitude":0.0,"altitude":0.0,"metaDataDefinitions":[{"name":"orientation","type":"float"},{"name":"windspeed","type":"int"}],"test":false}
  • metadata-names should be lowercase, orthodox spelling, without punctuation, for convention's sake. So windspeed, not wind_speed or windSpeed.
  • accepted types are float, int and string, respectively decimal numbers, whole numbers and text.


2. Sending tiks

  • SO, you've registered our clock and your connection to the server is still open : Congrats ! (otherwise, be sure you have performed all the neccessary steps listed above). You can now start sending Tiks ! The story from the Clock point of view :
  • “As a Clock logged on the TAK server, I want to start sending tiks”
    • To Tik, send a Tik object to the server :
      • If you send anything else but a Tik to the server, it will reset your connection
    • Example Tik object(s) in JSON
      1st TIK: {"metaDataValues":[{"name":"orientation","type":"float","value":"0.5"},{"name":"windspeed", "type":"float","value":"2.965"}]}
      2nd TIK: {"metaDataValues":[{"name":"orientation","type":"float","value":"0.4"},{"name":"windspeed", "type":"float","value":"53.245"}]}
      nth TIK: {"metaDataValues":[{"name":"orientation","type":"float","value":"0.78"},{"name":"windspeed", "type":"float","value":"23.5665"}]}
  • the types have to match the ones in the metaDataDefinition in the clock object!
  • if you don't have metaData, just send empty JSONS, like so:
    {}

3. Logging out :

  • unplug/reboot your arduino (or gently close the connection :)
 
windclocks/tak.txt · Last modified: 2012/02/27 16:54 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki