Post your own gestures via reddit:

C# Library

Additional help:
Communication is done via JSON message and you can send encoded
hashtables to exchange events.
Format: '{ "type":"factTypeStr", "slotName1":<slotValue1>, ... }'
Example: { "type":"Point", "x":5, "y":10, "on":132620664251.6834 }

To exchange code, you have to send an array with 2 values in the following form:
Format: [ "s-expression", "(function argument1, argument2, ...)"]
Example: [ "s-expression", "(printout t \"Hello world\" crlf)" ]

(Don't forget to escape the " using \", I omitted most of them for clarity)

To create/register your own handlers (i.e. socket connections) you
have to send a special initial message by the following protocol:
["register-input", { "name":"My-HandlerIn" }]           //  If you
want to send events to Midas (i.e. the input source of Midas)
["register-output", { "name":"My-HandlerOut" }]      // If you want to
receive events from Midas (i.e. the output source of Midas)

Note that the name of your handlers should be unique. You basically
have to use 2 sockets if you want a basic connection to Midas
(input/output) as then it is easier to either read or write to a
socket, without having to manage buffers etc.

A subscribe/publish always requires output handlers.

Example: [ "s-expression", "(subscribe "Point" "My-HandlerOut")" ]
Makes that every incoming event with type "Point" will be send to a
handler with the name "My-HandlerOut"

Example: [ "s-expression", "(publish "My-HandlerOut" (assert (Point (x
1) (y 2)))" ]
Publishes a new fact from Midas to the My-HandlerOut  (unnecessary if
you subscribed to Point events)

Basic initial test:
s ="localhost", 4337)
s.write("(printout t \"Hello\" crlf)")
// Should print Hello on the prompt of Midas
// If you don't provide a 'register-input' or 'register-output', Midas
assumes you want an input handler with a random generated name

Output test:
so ="localhost", 4337)
so.write("[\"register-output\", { \"name\":\"My-HandlerOut\" }]\n")
si ="localhost", 4337)
str = "(subscribe \"Point\" \"My-HandlerOut\")"
si.write("[ \"s-expression\", \""+str+"\"]\n")                     //
Or: Json.encode(["s-expression",str])
si.write("{ \"type\":\"Point\", \"x\":1 }\n")
print(  // should return { "type":"Point", "x":1 }
research/mudra/gestures.txt ยท Last modified: 2014/12/04 10:16 (external edit)
Trace: gestures