Simplified ParameterHandling. Same Class for all application
authorandre Ebersold <andre.ebersold@free.fr>
Sat, 18 Nov 2023 08:33:30 +0000 (09:33 +0100)
committerandre Ebersold <andre.ebersold@free.fr>
Sat, 18 Nov 2023 08:33:30 +0000 (09:33 +0100)
18 files changed:
Application/DCMotor/main.cpp
Application/PowerSwitch/main.cpp
Application/ShutterCtrl/main.cpp
Application/WorkhourMeter/CMakeLists.txt
Application/WorkhourMeter/Scheduler.cpp [new file with mode: 0644]
Application/WorkhourMeter/Scheduler.h [new file with mode: 0644]
Application/WorkhourMeter/main.cpp
Communication/CommunicationHandler.cpp
Communication/CommunicationHandler.h
HAL/Abstract/IUart.h
Metadata/CMakeLists.txt
Metadata/Metadata.h
Metadata/ShutterCtrlParamIds.h
Metadata/WorkMeterParameterTable.cpp
Platform/CMakeLists.txt
Platform/IParameterHandler.h
Platform/ParameterHandler.cpp
Platform/ParameterHandler.h

index 3d14737e58e948b99540b21e7b95b986c0a50b81..ace3bc2001c7e309b57e898853d2d8dc629310a1 100644 (file)
@@ -23,7 +23,7 @@
 #include <AVR/AvrPwm.h>
 #include <Platform/IParameterHandler.h>
 #include <Metadata/DCMotorParamIds.h>
-#include <Platform/DCMotorParameterHandler.h>
+#include <Platform/ParameterHandler.h>
 #include <Platform/PersistentStorage.h>
 #include <Communication/CommunicationHandler.h>
 
@@ -165,7 +165,7 @@ void init(IParameterHandler *m_Param)
 int main(void)
 {
    Timer1     lCounter;
-   DCMotorParameterHandler gParam; 
+   ParameterHandler gParam; 
 #if defined (__AVR_ATmega32U4__)
    Led0                 led(&PORTC, &DDRC, PINB7,&gParam);
    AvrPwm               pwmA;               
index 6ede18c2e88bbe51ca56b79bdec716256336d68d..4f337dcdddd0f18edebba2c17561dbf0dc480aa6 100644 (file)
@@ -20,7 +20,7 @@
 #include <AVR/AvrEeprom.h>
 #include <Platform/IParameterHandler.h>
 #include <Metadata/PowerswitchParamIds.h>
-#include <Platform/PowerswitchParameterHandler.h>
+#include <Platform/ParameterHandler.h>
 #include <Platform/PersistentStorage.h>
 #include <Communication/CommunicationHandler.h>
 
@@ -152,7 +152,7 @@ void init(IParameterHandler *m_Param)
  */
 int main(void)
 {
-   PowerswitchParameterHandler gParam; 
+   ParameterHandler gParam; 
 #if defined (__AVR_ATmega32U4__)
    Led0                 led(&PORTC, &DDRC, PINB7,&gParam);
 #else
index e0ee6d3732152dcd20111986f2537952224f5a6e..12ea68c84d8a8269246d78723c46d3aa2126d456 100644 (file)
@@ -24,7 +24,7 @@
 //#include <AVR/AvrPwm.h>
 #include <Platform/IParameterHandler.h>
 #include <Metadata/ShutterCtrlParamIds.h>
-#include <Platform/ShutterCtrlParameterHandler.h>
+#include <Platform/ParameterHandler.h>
 #include <Platform/PersistentStorage.h>
 #include <Communication/CommunicationHandler.h>
 
@@ -168,7 +168,7 @@ void init(IParameterHandler *m_Param)
 int main(void)
 {
    Timer1     lCounter;
-   ShutterCtrlParameterHandler gParam; 
+   ParameterHandler gParam; 
    Led0                 led(&PORTB, &DDRB, PINB5,&gParam);
    AvrUart              uart(IUart::BAUD_9600,IUart::PARITY_NONE,IUart::STB_ONE);
    AvrEeprom            gEeprom;
index 705607d2fcd2000592330b379de27018d6b55718..4f90315f27cc254c97eeb78a65b59ff8e3e86ca6 100644 (file)
@@ -6,6 +6,7 @@ add_avr_executable(
    main.cpp
    Led0.cpp
    WorkMeterHandler.cpp
+   Scheduler.cpp
    )
 
 target_link_libraries(
diff --git a/Application/WorkhourMeter/Scheduler.cpp b/Application/WorkhourMeter/Scheduler.cpp
new file mode 100644 (file)
index 0000000..b54d580
--- /dev/null
@@ -0,0 +1,124 @@
+#include <Utils/StdTypes.h>
+#include <util/delay.h>
+
+#include <Abstract/IInterruptActivity.h>
+#include <Abstract/IProtocolLayer2.h>
+#include <Abstract/IUart.h>
+#include <Abstract/II2C.h>
+#include <Abstract/IRtc.h>
+#include <Abstract/ILCD.h>
+#include "Abstract/RFID/IPN532Interface.h"
+#include <Abstract/IEeprom.h>
+#include <Application/ITask.h>
+#include <Platform/IParameterHandler.h>
+#include <Platform/ErrorHandler/IErrorHandler.h>
+#include <Metadata/WorkmeterParamIds.h>
+#include <Platform/ParameterHandler.h>
+
+#include "Led0.h"
+
+#include "Scheduler.h"
+
+
+
+Scheduler::Scheduler( Led0 *_led,IProtocolLayer2 *_net
+             , ITask *_com
+             , ITask *_argRtc
+             , ITask *_Storage
+             , ITask *_RFIDReader
+             )
+      : 
+              m_Led(_led)
+              , m_Netstring(_net)
+              , m_Com(_com)
+              , m_WorkMeter(_argRtc)
+              , m_Storage(_Storage)
+              , m_RFIDReader(_RFIDReader)
+              , m_CurrentTimeslot(FIRST_TIME_SLOT)
+              , m_CurrentTask(TASK1)
+    {
+    }
+// main entry point
+void Scheduler::schedule()
+{
+
+static const Scheduler::pFunction_t task[3] = {
+               &Scheduler::doTask1
+             , &Scheduler::doTask2
+             , &Scheduler::doTask3
+};
+
+
+    waitForTimeslot();
+    m_Com->run();
+#if 1
+    (this->*(task[m_CurrentTask]))();
+#else
+    switch (m_CurrentTask)
+    {
+        case TASK1:
+           //m_Adc->run();
+        m_WorkMeter->run();
+        //m_Led->tick();
+        break;
+        case TASK2:
+        m_Led->tick();
+        m_RFIDReader->run();
+        break;
+        case TASK3:
+        m_Led->tick();
+        m_Storage->run();
+        break;
+        default:
+        ;
+
+    }
+#endif
+    m_CurrentTask = gTasks[m_CurrentTask].m_NextTask;
+}
+
+void Scheduler::doTask1()
+{
+    m_WorkMeter->run();
+}
+void Scheduler::doTask2()
+{
+    m_Led->tick();
+    m_RFIDReader->run();
+}
+void Scheduler::doTask3()
+{
+    m_Led->tick();
+    m_Storage->run();
+}
+    
+// called  by the interrupt timer handler
+void Scheduler::tick()
+{
+    m_CurrentTimeslot = (m_CurrentTimeslot < LAST_TIME_SLOT)
+                       ? (TIME_SLOTS)(m_CurrentTimeslot+1) 
+                       : (FIRST_TIME_SLOT);
+    m_Netstring->tick();
+}
+
+void Scheduler::waitForTimeslot( void )
+{
+    /// prevent instant scheduling 
+    while (m_CurrentTimeslot  == gTasks[m_CurrentTask].m_FirstTimeslot )
+    {
+       ;
+    }
+    // beginning of the timeslot
+    while (m_CurrentTimeslot  != gTasks[m_CurrentTask].m_FirstTimeslot ) 
+    {
+       ;
+    }
+}
+
+
+Scheduler::Task_type Scheduler::gTasks[TASK_COUNT] = {
+    { FIRST_TIME_SLOT , TASK2 }
+  , { BLOCK2_FIRST_TIME_SLOT, TASK3 }
+  , { BLOCK3_FIRST_TIME_SLOT, TASK1 }
+};
+
diff --git a/Application/WorkhourMeter/Scheduler.h b/Application/WorkhourMeter/Scheduler.h
new file mode 100644 (file)
index 0000000..eec15ad
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef __SCHEDULER_H__
+#define __SCHEDULER_H__
+
+/**
+ * @brief the scheduler will still slice the execution
+ * flow. The whole cycle is now 40 ticks !
+ * 40 * 
+ * 250ns * 4 = 1us * 10 = 10 us. On fast devices.
+ *
+ * 16MHz / 8 / 256 = 100us each tick
+ *
+ */
+class Scheduler : public IInterruptActivity
+{
+      typedef void (Scheduler::*pFunction_t)();
+  private:
+      enum TIME_SLOTS {
+              FIRST_TIME_SLOT        =  0,
+              BLOCK2_FIRST_TIME_SLOT =  30,
+              BLOCK3_FIRST_TIME_SLOT =  60,
+              LAST_TIME_SLOT         =  99,
+              TIME_SLOT_COUNT        = 99  // :( not used 
+      };
+      enum ETASK_ID {
+              TASK1      = 0,
+              TASK2      = 1,
+              TASK3      = 2,
+              TASK_COUNT = 3
+      };
+      typedef struct Task_t {
+          TIME_SLOTS  m_FirstTimeslot;
+          ETASK_ID    m_NextTask;
+      } Task_type ;
+
+      static Task_type gTasks[TASK_COUNT];
+  private:
+    Led0                   *m_Led;
+    IProtocolLayer2        *m_Netstring;
+    ITask                  *m_Com;
+    ITask                  *m_WorkMeter;
+    ITask                  *m_Storage;
+    ITask                  *m_RFIDReader;
+    volatile TIME_SLOTS     m_CurrentTimeslot;
+    ETASK_ID                m_CurrentTask;
+    RtcTime_t               m_Time;
+  private:
+        void doTask1();
+
+        void doTask2();
+        void doTask3();
+  public:
+    Scheduler( Led0 *_led,IProtocolLayer2 *_net
+             , ITask *_com
+             , ITask *_argRtc
+             , ITask *_Storage
+             , ITask *_RFIDReader
+             );
+
+    // main entry point
+    void schedule();
+
+    // called  by the interrupt timer handler
+    virtual void tick();
+
+  private:
+    void waitForTimeslot( void ) ;
+};
+
+#endif
index 6f4b2b4c420f8198029ab15609c01ab1766026b5..6fe2c250671378d10deb492eb40864acfed59d2b 100644 (file)
 #include <Platform/RFIDReader/RFIDReaderHandler.h>
 #include "Led0.h"
 #include "WorkMeterHandler.h"
-#if 0
-#include "Switch.h"
-#include "PowerswitchHandler.h"
-#endif
+#include "Scheduler.h"
+
 /**
  * @brief the scheduler will still slice the execution
  * flow. The whole cycle is now 40 ticks !
  * 16MHz / 8 / 256 = 100us each tick
  *
  */
-class Scheduler : public IInterruptActivity
-{
-      typedef void (Scheduler::*pFunction_t)();
-  private:
-      enum TIME_SLOTS {
-              FIRST_TIME_SLOT        =  0,
-              BLOCK2_FIRST_TIME_SLOT =  30,
-              BLOCK3_FIRST_TIME_SLOT =  60,
-              LAST_TIME_SLOT         =  99,
-              TIME_SLOT_COUNT        = 99  // :( not used 
-      };
-      enum ETASK_ID {
-              TASK1      = 0,
-              TASK2      = 1,
-              TASK3      = 2,
-              TASK_COUNT = 3
-      };
-      typedef struct Task_t {
-          TIME_SLOTS  m_FirstTimeslot;
-          ETASK_ID    m_NextTask;
-      } Task_type ;
-
-      static Task_type gTasks[TASK_COUNT];
-  private:
-    Led0                   *m_Led;
-    IProtocolLayer2        *m_Netstring;
-    CommunicationHandler   *m_Com;
-    ITask                  *m_WorkMeter;
-    ITask                  *m_Storage;
-    ITask                  *m_RFIDReader;
-    volatile TIME_SLOTS     m_CurrentTimeslot;
-    ETASK_ID                m_CurrentTask;
-    RtcTime_t               m_Time;
-  private:
-        void doTask1()
-        {
-            m_WorkMeter->run();
-        }
-        void doTask2()
-        {
-            m_Led->tick();
-            m_RFIDReader->run();
-        }
-        void doTask3()
-        {
-            m_Led->tick();
-            m_Storage->run();
-        }
-  public:
-    Scheduler( Led0 *_led,IProtocolLayer2 *_net
-             , CommunicationHandler *_com
-             , ITask *_argRtc
-             , ITask *_Storage
-             , ITask *_RFIDReader
-             )
-      : 
-              m_Led(_led)
-              , m_Netstring(_net)
-              , m_Com(_com)
-              , m_WorkMeter(_argRtc)
-              , m_Storage(_Storage)
-              , m_RFIDReader(_RFIDReader)
-              , m_CurrentTimeslot(FIRST_TIME_SLOT)
-              , m_CurrentTask(TASK1)
-    {
-    }
-    // main entry point
-    void schedule()
-    {
-
-        static const Scheduler::pFunction_t task[3] = {
-           &Scheduler::doTask1
-         , &Scheduler::doTask2
-         , &Scheduler::doTask3
-       };
-
-
-        waitForTimeslot();
-        m_Com->run();
-#if 1
-       (this->*(task[m_CurrentTask]))();
-#else
-       switch (m_CurrentTask)
-        {
-            case TASK1:
-               //m_Adc->run();
-                m_WorkMeter->run();
-                //m_Led->tick();
-            break;
-            case TASK2:
-                m_Led->tick();
-                m_RFIDReader->run();
-            break;
-            case TASK3:
-                m_Led->tick();
-                m_Storage->run();
-            break;
-            default:
-            ;
-        
-        }
-#endif
-        m_CurrentTask = gTasks[m_CurrentTask].m_NextTask;
-    }
-
-    // called  by the interrupt timer handler
-    virtual void tick()
-    {
-            m_CurrentTimeslot = (m_CurrentTimeslot < LAST_TIME_SLOT)
-                                ? (TIME_SLOTS)(m_CurrentTimeslot+1) 
-                                : (FIRST_TIME_SLOT);
-            m_Netstring->tick();
-    }
-
-  private:
-    void waitForTimeslot( void )
-    {
-            /// prevent instant scheduling 
-            while (m_CurrentTimeslot  == gTasks[m_CurrentTask].m_FirstTimeslot )
-            {
-                ;
-            }
-            // beginning of the timeslot
-            while (m_CurrentTimeslot  != gTasks[m_CurrentTask].m_FirstTimeslot ) 
-            {
-                ;
-            }
-    }
-
-
-};
-
-Scheduler::Task_type Scheduler::gTasks[TASK_COUNT] = {
-    { FIRST_TIME_SLOT , TASK2 }
-  , { BLOCK2_FIRST_TIME_SLOT, TASK3 }
-  , { BLOCK3_FIRST_TIME_SLOT, TASK1 }
-};
-
 /**
  * \brief Init database ....
  */
@@ -212,7 +72,7 @@ int main(void)
 #else
    Led0                 led(&PORTB, &DDRB, PINB5,&gParam);
 #endif   
-   AvrUart              uart(IUart::BAUD_9600,IUart::PARITY_NONE,IUart::STB_ONE);
+   AvrUart              uart(IUart::BAUD_19200,IUart::PARITY_NONE,IUart::STB_ONE);
    AvrI2C               gI2c;
    DS3231               gRtc(&gI2c);
    LiquidCrystal        lcd(&gI2c
@@ -257,7 +117,7 @@ int main(void)
    msg[0]= static_cast<Uint8_t >( (ver >>16 & 0xFF)  + 48 );
    msg[1]= static_cast<Uint8_t >( (ver  >>8 & 0xFF ) + 48 );
    lcd.print(msg);
-   nfc.setPassiveActivationRetries(0x01);
+   nfc.setPassiveActivationRetries(0x03);
    nfc.SAMConfig();
    lTimer.init();
    init(&gParam);
index 4fbaeb86458e0b29630b3e9f55758c7498722bf4..d9468d541e8b53bff1a13b365a5eef05e0c27d5e 100644 (file)
@@ -6,6 +6,8 @@
 #include <Metadata/DCMotorParamIds.h> // To be removed
 #endif
 #include <Platform/IParameterHandler.h>
+#include <Application/ITask.h>
+#include <Metadata/Metadata.h>
 #include <Communication/CommunicationHandler.h>
 
 CommunicationHandler::CommunicationHandler(IProtocolLayer2 *_l2,IParameterHandler *_p)
@@ -51,17 +53,17 @@ CommunicationHandler::run()
 #endif
             case 'M':
               {
-                  parse_msg(msg,len ,IParameterHandler::TYPE_U16);
+                  parse_msg(msg,len ,TYPE_U16);
               }
               break;
             case 'L':
               {
-                  parse_msg(msg,len ,IParameterHandler::TYPE_U32);
+                  parse_msg(msg,len ,TYPE_U32);
               }
               break;
             case 'F':
               {
-                  parse_msg(msg,len ,IParameterHandler::TYPE_FLOAT);
+                  parse_msg(msg,len ,TYPE_FLOAT);
               }
               break;
             default:
@@ -73,7 +75,7 @@ CommunicationHandler::run()
 
 #define OUTPUT_BUFFER_SIZE 32
 void 
-CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameterHandler::eParameterType _eType)
+CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,eParameterType _eType)
 {
     uint32_t nv  = 0;
     uint32_t val = 0;
@@ -88,7 +90,7 @@ CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameter
     }
     if ( _msg[pos] == '=' )
     {
-        if (_eType == IParameterHandler::TYPE_FLOAT)
+        if (_eType == TYPE_FLOAT)
         {
             Float32_t result;
             result = atof((const char *)(_msg+1+pos));
@@ -104,13 +106,13 @@ CommunicationHandler::parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameter
     {
         char l_OutBuffer[OUTPUT_BUFFER_SIZE];
         for (Uint8_t i = 0 ; i < OUTPUT_BUFFER_SIZE; i++) l_OutBuffer[i] = '\0';
-        if (_eType == IParameterHandler::TYPE_FLOAT)
+        if (_eType == TYPE_FLOAT)
         {
             Float32_t fval;
             m_Params->readValue(nv,fval);
             //dtostre(fval,(char *)l_OutBuffer,4,0);
             dtostrf(fval,8,4,(char *)l_OutBuffer);
-        } else if (_eType == IParameterHandler::TYPE_U32)
+        } else if (_eType == TYPE_U32)
         {
             m_Params->readValue(nv,val);
             ltoa(val,(char *)l_OutBuffer,10);
index 54563ccc8c16f3bb0181873071192a1e03daf537..ebcad76b4617e438d80347011357b6bec4b8ffb2 100644 (file)
@@ -2,14 +2,14 @@
 #define  __COMMUNICATIONHANDLER_H__
 
 class CommunicationHandler 
-/* : public ITask */
+ : public ITask 
 {
     public:
         CommunicationHandler(IProtocolLayer2 *_l2,IParameterHandler *_p);
 
         virtual void run();
     private:
-        void parse_msg(const Uint8_t *_msg,const Uint8_t len,IParameterHandler::eParameterType _eT);
+        void parse_msg(const Uint8_t *_msg,const Uint8_t len,eParameterType _eT);
         ///
         void parse_num(const Uint8_t *_msg,const Uint8_t len,  Uint32_t &_out);
     private:
index f308173140398e7ae99f86dbf937dd8bed05a6ff..1835ebf8cdbc38c99df22a5b13c79f05e10ae0f9 100644 (file)
@@ -22,8 +22,9 @@ class IUart
       enum Baudrate_t { BAUD_2400 = 0
           ,BAUD_9600    = 1
           ,BAUD_19200   = 2
+          ,BAUD_33600   = 3
           ,BAUD_57600   = 4
-          ,BAUD_115200  = 6
+          ,BAUD_115200  = 5
     };
 #endif
     
index f6cb12bc3815d3b2d844cce160b0b9891e6d8a24..dd5f5afed3576701f91fc32bccc02d17687ddf00 100644 (file)
@@ -6,18 +6,36 @@ add_avr_library(
     PowerswitchParameterTable.cpp
    )
 
+set_target_properties(
+    avrPowerswitchParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES
+    COMPILE_DEFINITIONS POWERSWITCH_PARAMETERS
+    )
 add_avr_library(
     avrDCMotorParameters
     DCMotorParameterTable.cpp
    )
 
+set_target_properties(
+    avrDCMotorParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES
+    COMPILE_DEFINITIONS DCMOTOR_PARAMETERS
+    )
+
 add_avr_library(
     avrShutterCtrlParameters
     ShutterCtrlParameterTable.cpp
    )
 
+set_target_properties(
+    avrShutterCtrlParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES
+    COMPILE_DEFINITIONS SHUTTERCTRL_PARAMETERS
+    )
+
 add_avr_library(
     avrWorkMeterParameters
     WorkMeterParameterTable.cpp
    )
 
+set_target_properties(
+    avrWorkMeterParameters${MCU_TYPE_FOR_FILENAME} PROPERTIES
+    COMPILE_DEFINITIONS WORKMETER_PARAMETERS
+    )
index e630bec28de14f2c9fe595275dd28544ccb91074..3809bf06e1b12c9ae68dcee8530068523c955441 100644 (file)
@@ -1,6 +1,28 @@
 #ifndef __METADATA_H__
 #define __METADATA_H__
 
+enum eParameterType {
+      TYPE_U8    = 0
+    , TYPE_U16   = 1
+    , TYPE_U32   = 2
+    , TYPE_I8    = 4
+    , TYPE_I16   = 4
+    , TYPE_I32   = 5
+    , TYPE_FLOAT = 6
+};
+
+enum eParameterLevel {
+    ALL
+   ,EUP = 1
+   ,SUP = 2
+   ,FUP = 3
+};
+enum eParameterAcess {
+  NONE  = 0
+  ,RO   = 1
+  ,WO   = 2
+  ,RW   = 3
+};
 /* Forward declaration */
 class IParameterListener;
 
@@ -17,5 +39,14 @@ typedef struct _ParameterValue_t
       Float32_t  m_Float;
   } u;
   IParameterListener *m_Listener;
+#if defined(WORKMETER_PARAMETERS)
+  union ParameterAttributes
+  {
+      uint8_t    m_AllAttributes;
+      uint8_t    m_Type:4;
+      uint8_t    m_AccessLevel:2;
+      uint8_t    m_AccessRight:2;
+  } a;
+#endif
 } ParameterValue;
 #endif
index 84a9c7d0200e59101674efbe5aaed9b91f23d2b8..fd03f44cfdcfb5fbb3aa482b1e1329e8e4c25021 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __DCMOTORPARAMIDS_H__
-#define __DCMOTORPARAMIDS_H__
+#ifndef __SHUTTERCTRLPARAMIDS_H__
+#define __SHUTTERCTRLPARAMIDS_H__
 
 
 /**
index a2cdf6b0ce55f0d51d8cf1209d094d094a963cf0..14bb05fc77819973c6c5460032a9da719dd27401 100644 (file)
@@ -5,25 +5,29 @@
 #include "WorkMeterParamIds.h"
 #include "ParameterTable.h"
 
-
+#if 0
+      uint8_t    m_Type:4;
+      uint8_t    m_AccessLevel:2;
+      uint8_t    m_AccessRight:2;
+#endif
 ParameterValue m_Values[PID_MAX] =
 {
-  {0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
-  ,{0,NULL}
+  {0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_I32<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
+  ,{0,NULL , (TYPE_U8<<4) | (NONE<<2) | (RW)}
 
 };
index c225ef8d9fd4351bda51c822ad4a6e68caf4d87f..9a78286dac0972f293016a5e13bab9e6467341b2 100644 (file)
@@ -3,7 +3,7 @@
 #####################################################################
 add_avr_library(
     avrPtf
-    DCMotorParameterHandler.cpp
+    ParameterHandler.cpp
     PersistentStorage.cpp
    )
 
@@ -17,12 +17,12 @@ set_target_properties(
 #
 add_avr_library(
     avrPS-Ptf
-    PowerswitchParameterHandler.cpp
+    ParameterHandler.cpp
     PersistentStorage.cpp
    )
 
 set_target_properties(
-    avrPtf${MCU_TYPE_FOR_FILENAME} PROPERTIES
+    avrPS-Ptf${MCU_TYPE_FOR_FILENAME} PROPERTIES
     COMPILE_DEFINITIONS POWERSWITCH_PARAMETERS
 )
 #
@@ -30,12 +30,12 @@ set_target_properties(
 #
 add_avr_library(
     avrSC-Ptf
-    ShutterCtrlParameterHandler.cpp
+    ParameterHandler.cpp
     PersistentStorage.cpp
    )
 
 set_target_properties(
-    avrPtf${MCU_TYPE_FOR_FILENAME} PROPERTIES
+    avrSC-Ptf${MCU_TYPE_FOR_FILENAME} PROPERTIES
     COMPILE_DEFINITIONS SHUTTERCTRL_PARAMETERS
 )
 
index f6dc39188471a8a9053264fa88e1e57419205caf..7fe580ffdcadfc963a3c3fe91989d523ea6c5583 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __IPARAMETER_HANDLER_H__
 #define __IPARAMETER_HANDLER_H__
 
+#include "Metadata/Metadata.h"
+
 /**
  * \brief interface to be implemented by
  * objects that need to be informed that a parameter
@@ -25,12 +27,17 @@ class IParameterListener
 class IParameterHandler
 {
     public:
+#if 0
         enum eParameterType {
               TYPE_U8    = 0
             , TYPE_U16   = 1
             , TYPE_U32   = 2
-            , TYPE_FLOAT = 3
+            , TYPE_I8    = 4
+            , TYPE_I16   = 4
+            , TYPE_I32   = 5
+            , TYPE_FLOAT = 6
         };
+#endif
     public:
         IParameterHandler() {};
         
@@ -51,5 +58,11 @@ class IParameterHandler
         virtual void writeValue(const uint8_t paramID,const Float32_t _val) = 0;
         ///
         virtual void registerListener(const uint8_t paramID,IParameterListener *_val) = 0;
+
+        // get Parameter ID value as string
+        virtual Bool_t toString(const uint8_t paramID, eParameterType _eType,Uint8_t *buffer) = 0 ;
+        // set Parameter ID value from string
+        // In case of type mismatch, return fail and don't assign the value
+        virtual Bool_t fromString(const uint8_t paramID, eParameterType _eType,Uint8_t *buffer) = 0 ;
 };
 #endif
index ab461a6a5bdf70b0eb5082d2fc95440bbb39ab0b..571563340f224d95a77e608b300f28b587d73f67 100644 (file)
@@ -4,6 +4,12 @@
 #ifdef POWERSWITCH_PARAMETERS
 #include <Metadata/PowerswitchParamIds.h>
 #include <Metadata/PowerswitchParameterTable.h>
+#elif defined(DCMOTOR_PARAMETERS)
+#include <Metadata/DCMotorParamIds.h>
+#include <Metadata/DCMotorParameterTable.h>
+#elif defined(SHUTTERCTRL_PARAMETERS)
+#include <Metadata/ShutterCtrlParamIds.h>
+#include <Metadata/ShutterCtrlParameterTable.h>
 #elif defined(WORKMETER_PARAMETERS)
 #include <Metadata/WorkMeterParamIds.h>
 #include <Metadata/ParameterTable.h>
@@ -120,3 +126,22 @@ ParameterHandler::registerListener(const uint8_t paramID,IParameterListener *_va
     } 
 
 }
+
+
+// get Parameter ID value as string
+Bool_t ParameterHandler::toString(const uint8_t paramID
+               , eParameterType _eType
+               , Uint8_t *buffer)
+{
+    return true;
+}
+// set Parameter ID value from string
+// In case of type mismatch, return fail and don't assign the value
+Bool_t ParameterHandler::fromString(const uint8_t paramID
+                 , eParameterType _eType
+                 , Uint8_t *buffer)
+{
+    return true;
+}
+
+
index 22554984ab1f19be722ff16a72b7c561c93ed223..d34b611ea4f7f222ec518d23fccfefb860f9b1b5 100644 (file)
@@ -30,6 +30,15 @@ class ParameterHandler : public IParameterHandler
         ///
         virtual void registerListener(const uint8_t paramID,IParameterListener *_val);
 
+        // get Parameter ID value as string
+        Bool_t toString(const uint8_t paramID
+                       , eParameterType _eType
+                       , Uint8_t *buffer)  ;
+        // set Parameter ID value from string
+        // In case of type mismatch, return fail and don't assign the value
+        Bool_t fromString(const uint8_t paramID
+                         , eParameterType _eType
+                         , Uint8_t *buffer) ;
 
     private:
 };