DEMO 4 - Recipes: create recipe type and save recipes

A simple example to illustrate how a recipe type is created and recipes are saved

  (...)

 
  
int i,j;  
dyn_string myRegisters;   
dyn_int myTypes;  
dyn_dyn_anytype myData;   
  
dyn_string regs;  
dyn_dyn_anytype data;   
  
 string dpType = "HwTypeCCPCTELL1_OT";    //name of the datapoint type (needed for recipe type)
 string recipeType  = "TELL1_OT_BB";      //name of the recipe type
 string hardware = "myTell1_OT";          //name of the chosen hardware/datapoint (needed for recipe)

//NOTE: do not use the '/' character in the name of the recipe type!!!
//      This will lead to misbehavior.
 
//  ********defining recipe type******** 
   
dynClear(myRegisters);  

//registers belonging to a recipe type
myRegisters = makeDynString(   
".GBE.PORT0.TXFifoHighWtrmrk",  
".GBE.PORT0.TXFifoLowWtrmrk");    
 
//type of the above registers 
myTypes = makeDynInt(  
   FWHW_GBE,  
   FWHW_GBE); 
  
fwHw_createRecipeType(recipeType,dpType,myRegisters);  
   
 
DebugN("Recipe types related to hw-type: " + dpType);  
DebugN(fwHw_getRecipeTypes(dpType));  
   
   
DebugN("Registers belonging to recipe type: " + recipeType);  
fwHw_getRecipeTypeInfo(recipeType, dpType, regs);  
DebugN(regs); 
  
   
 
 
 
  
//  ********defining/saving recipe******** 
  
 
dynAppend(myData, fwHw_convertHexToByte("000000ad"));    
dynAppend(myData, fwHw_convertHexToByte("000000ff"));   

//NOTE: to save a recipe of a certain recipe type, the registers list has to be passed again
//      but this time with the hardware/datapoint name in front  

for(i = 1; i <= dynlen(myRegisters); i++)  
   myRegisters[i] = hardware + myRegisters[i];  
  
//A recipe with the name "LAB/Configure/testX" is created
//If no data is passed the values last written to the register's datapoint (.writings) are taken   
fwHw_saveRecipe(hardware, recipeType,"LAB/Configure/test1");          
//If other values shall be applied the register names and types have to be provided in addition
fwHw_saveRecipe(hardware, recipeType,"LAB/Configure/test2",myRegisters, myTypes, myData);     
  
    
  
//  ********information about recipes*********  
  
 
DebugN("Get recipe names related to hardware" + hardware); 
DebugN(fwHw_getRecipes(hardware));   


 
 (...)

Generated on Mon Jan 28 10:40:20 2008 for FwHw by  doxygen 1.4.7