/* DDC control
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456*/
/*===================================-======================================*/
/*                         DDC STATE & DATA CONTROL                         */
/*-----------------------------------=--------------------------------------*/
/* AUTHORs:        P.Ferrari & Heidi Sandaker

   DESIGN ISSUEs:  Run state transitions

   MODIF_HISTORY:  25.07.2003 - first version
/*===================================-======================================*/

main()
{ 
DebugN("Started main");
dpConnect("SendState","example.trigger:_original.._value");
}

 void SendState(string Text, bool Flag)
 { string     string, mstr, estr;
   dyn_string info;
   string     name;
   int        stat, resp, len1, len2, eror;
   string datapoint1;
   int i,j;
   dyn_string valset; 
   dyn_float initValue;

DebugN("Enter function SendState");

    dpGet("example.parameters:_original.._value", string);
     info = strsplit(string,"|");
     sscanf(info[1],"%d",stat);
       DebugN("**INFO",info[1]);
     if(stat==0){
       DebugN("OFF");
     }
     else if(stat==1){


	for (i=0;i<=31;i++){
	valset=makeDynString("LVcaTrip","LVcaMask","LVch_Vcc","LVch_Vdd","LVchVCSV","LVchPINV","LVchDTrp","LVchCTrp","LVchTTrp","LVchTLim","LVchCLKS","LVchCLKR","LVchVOut");
	initValue=makeDynFloat(46,15,0.0,0,0,0,50,50,50,60,0,0,0);
 	for(j=1; j<=13; j++)
    	  {
      	  sprintf(datapoint1, "Crate00.Channel%02d.%s.Send:_original.._value",i,valset[j] );
      	  dpSetWait(datapoint1, initValue[j]);
   	  }
   }
 }  

