Project

General

Profile

Javascript » History » Revision 6

Revision 5 (Torbjorn Carlqvist Admin, 09/01/2021 02:19 PM) → Revision 6/28 (Torbjorn Carlqvist Admin, 09/01/2021 02:26 PM)

h1. Javascript guide for DTXr code IDE 


 

 h2. Commands 


 h3. *print*    print - Prints a message to footer log window as well as the automation.log file 

 <pre><code class="javascript">print("hello");</code></pre> 

 h3. *readProperty*    h2. readProperty - Reads an object property value 

 <pre><code class="javascript"> 
 //Reads a present value from analog input object 0. 
 Controller.readProperty(85343,analogInput,0,presentValue); 

 //Use the result to print and in logic 
 res = Controller.readProperty(85343,analogInput,0,presentValue); 
 print(res); 
 if ( res > 0 ){ 
   print("value larger than 0!"); 
 } 
 </code></pre> 

 h2. Events 

 h3. eventNotificationReceived 

 <pre><code class="javascript"> 
 /*********************************************************************************************** 
  * Called when the controller receives a notification (intrinsic reporting) from another device 
  * @param {Number} device - The device that send the event 
  * @param {Number} objectType - The source object of the event 
  * @param {Number} objectInstance - The instance of source object 
  * @param {Number} eventType - The type of event received 
  * @param {String} fromState - The previous state 
  * @param {String} toState - The current state after the change 
  * @param {Object} eventValues - A map of specific values for this particular eventType  
  ***********************************************************************************************/ 
 function eventNotificationReceived(processIdentifier,initiatingDevice,object,objectType,objectInstance,timeStampUTC,notificationClass,priority,eventType,messageText,notifyType,ackRequired,fromState,toState,eventValues){ 
 } 
 </code></pre>