DEMO 2: How to remove hardware

A simple example to illustrate the usage of the FwHw framework: In order not to clear the entire system with fwHw_Clear() single hardwares can be removed as well as complete hardware types (including their hardware instances).

  (...)

   
  
   // ===========================================
   //  DERIVE HARDWARES FROM HARDWARE TYPE 'BOARD' AND SUBSCRIBE THEM
   // ===========================================
   if (fwHw_create("BOARD", "myBOARD1"))
      DebugTN("Hardware 'myBOARD1' of hardware type 'BOARD' created successfully!");
   else
      DebugTN("Creating hardware 'myBOARD1' of hardware type 'BOARD' failed!");
   if (fwHw_create("BOARD", "myBOARD2"))
      DebugTN("Hardware 'myBOARD2' of hardware type 'BOARD' created successfully!");
   else
      DebugTN("Creating hardware 'myBOARD2' of hardware type 'BOARD' failed!");
   if (fwHw_subscribe("myBOARD2"))
      DebugTN("All registers from hardware 'myBOARD2' subscribed!");
   else
      DebugTN("Registers from hardware 'myBOARD2' could not be subscribed!");
   if (fwHw_subscribe("myBOARD1"))
      DebugTN("All registers from hardware 'myBOARD1' subscribed!");
   else
      DebugTN("Registers from hardware 'myBOARD1' could not be subscribed!");



   // ===========================================
   //  REMOVE HARDWARES AND HARDWARETYPES
   // ===========================================
 

   if (fwHw_remove("BOARD", "myBOARD2"))              //services and commands are unsubscribed first (also at server side) then
      DebugTN("Hardware 'myBOARD2' was removed!");    //the complete datapoint of the hardware is removed
   else                                               //(for removing the subscription fwHw_unsubscribe() is called inside)
      DebugTN("Hardware 'myBOARD2' could not be removed!");


 
   if (fwHw_removeType("BOARD"))                                 //the complete datapoint type of the hardware is removed
      DebugTN("Hardware Type 'BOARD' was removed!");             //including all instances (myBOARD1 still remaining - myBoard2 removed above)
   else                                                          //fwHw_removeType() calls fwHw_remove() to remove the instances
      DebugTN("Hardware Type 'BOARD' could not be removed!");
 

 (...)

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