Display offers an Inner Messaging System called IMS.
Any Sensor/module/machine can fire messages to the entire system.
Display runs also the Message Board, you can open and close the Message board using the relative toggle button in display. Display uses the Message Board during the loading process and during the creation of instances. You can follow the activity via Message Board.
Any Sensor/module/bot can fire messages to the Message Board:
msg("hallo!");
A message can have html content and also javascript code, it will be appended to the Message board and possibly executed.
You can fire a message to the Message Board and any other module existing inside the Console or you can send messages and exchange informations with other Sensors/modules/machines existing in the Page
globalMessage("my message","key param","ID","sender-ID");
Page_Message
globalMessage("my message","optional",null); public message
sent by a Sensor to all other sensors existing in the Page/Console
if those sensors are programmed to react to that message they may trigger a complex behaviour or use the IMS as a medium for interaction.
globalMessage("my message","optional","ID"); private message
will be sent only to the Sensor with that ID inside the memory ( the array Sensors[] )
When you know where you send the message ( ID ) you can exploit both message and keycode strings in order to transmit more informations or to organize a more complex communication.
Note that the message can always be HTML content, the message is appended to the Message Board.
It can contain an html element like a button and trigger a function existing in the Sensor.
A well done Custom Sensor can transform the Message Board into a realtime chat-room with interactive elements.
FOR DEVELOPERS
There are some basic messages your Custom Sensor should react to.
Your code must contain the following:
Custom.prototype.gMsg=function(str,param){ your standard reactions + custom reactions }
when someone fires a globalMessage, if the ID is null the message is farwarded to all Sensors and specifically to gMsg(str,param)
Your sensor must answer to the following requests:
globalMessage("","get_name",null,"sender-ID");
name of the Custom Sensor
globalMessage("","get_id",null,"sender-ID");
once instanciated each Sensor has its own ID, it can be used for 1to1 interaction
globalMessage("","get_info",null,"sender-ID");
informations and description
So you need a code like:
Custom.prototype.gMsg=function(str,param){
if(param == "get_name")msg("NAME: "+this.name);
if(param == "get_id")msg("ID: "+this.id);
if(param == "get_info")msg("your custom info");
}
A Sensor can send a globalMEssage to its own ID
globalMessage("","get_info","myID","myID");
if sender = null the global message will be delivered to the sender as well.