8 #ifndef __MC_DEVICE_RUNNABLE_H
9 #define __MC_DEVICE_RUNNABLE_H
12 #include "mc_dataList.h"
13 #include "ENUM_MCUpdateIntervals.h"
14 #include "ENUM_MCStatus.h"
19 #include "system_ticks.h"
25 #define MAX_MC_DEVICES 32
31 friend void mcd_verboseUnregistered(
bool on);
32 friend void mcd_verbosePort(
int,
int);
40 static void add(uint8 z_deviceNumber,
42 ENUM_MCUpdateIntervals z_frequency);
45 static void add(
mc_data *z_data, uint32 z_timeout, uint16 z_network);
47 inline bool getEnable(){
return m_enable;};
48 inline bool getOnline(){
return m_online;};
49 inline uint8 getModbusAddress(){
return m_modbusAddress;};
50 inline uint32 getTimeout(){
return m_timeout;};
51 inline uint16 getNetwork(){
return m_network;};
52 inline double getAHIGHI(){
return m_AHIGHI/get_ticks_per_second();};
53 inline double getAMEDI(){
return m_AMEDI/get_ticks_per_second();};
54 inline double getALOWI(){
return m_ALOWI/get_ticks_per_second();};
57 inline uint32 getTOTAL_RQ(){uint32 t = m_TOTAL_RQ; m_TOTAL_RQ = 0;
return t;};
58 inline uint32 getTOTAL_GD(){uint32 t = m_TOTAL_GD; m_TOTAL_GD = 0;
return t;};
59 inline uint32 getTOTAL_BD(){uint32 t = m_TOTAL_BD; m_TOTAL_BD = 0;
return t;};
60 inline uint32 getTOTAL_01(){uint32 t = m_TOTAL_01; m_TOTAL_01 = 0;
return t;};
61 inline uint32 getTOTAL_09(){uint32 t = m_TOTAL_09; m_TOTAL_09 = 0;
return t;};
62 inline uint32 getTOTAL_02(){uint32 t = m_TOTAL_02; m_TOTAL_02 = 0;
return t;};
63 inline uint32 getTOTAL_03(){uint32 t = m_TOTAL_03; m_TOTAL_03 = 0;
return t;};
64 inline uint32 getTOTAL_04(){uint32 t = m_TOTAL_04; m_TOTAL_04 = 0;
return t;};
65 inline uint32 getTOTAL_10(){uint32 t = m_TOTAL_10; m_TOTAL_10 = 0;
return t;};
66 inline uint32 getTOTAL_11(){uint32 t = m_TOTAL_11; m_TOTAL_11 = 0;
return t;};
67 inline uint32 getTOTAL_TO(){uint32 t = m_TOTAL_TO; m_TOTAL_TO = 0;
return t;};
68 inline uint32 getTOTAL_RT(){uint32 t = m_TOTAL_RT; m_TOTAL_RT = 0;
return t;};
69 inline uint32 getTOTAL_LB(){uint32 t = m_TOTAL_LB; m_TOTAL_LB = 0;
return t;};
70 inline uint32 getTOTAL_MR(){uint32 t = m_TOTAL_MR; m_TOTAL_MR = 0;
return t;};
71 inline ENUM_MCStatus getStatus(){
return m_lastStatus;};
76 static void setNumberOfDevices(uint16 z_numberOfDevices);
79 static void setTaskPriority(uint8 z_priority);
80 static void setTaskStack(uint16 z_stackSize);
82 int open(
char *z_addressOrName);
83 ENUM_MCStatus login(
int z_socketFd, uint8 z_modbusAddress);
84 ENUM_MCStatus getDataStatus(
void);
86 void setAddressOrName(
char *z_addressOrName);
87 void setModbusAddress(uint8 z_modbusAddress);
88 void setPidAddress(uint8 z_pidAddress);
89 void setUsername(
char *z_username);
90 void setPassword(
char *z_password);
91 void setSocketTimeout(uint32 z_timeout);
92 void setNetwork(uint16 z_network);
93 void setRetries(uint16 z_retries);
94 void setMaxBlockSize(uint16 z_maxBlock);
95 void setEnable(
bool z_enable);
96 void setOnline(
bool z_online);
97 void setBoundaries(uint16 z_numberOfBoundaries, uint16 *z_boundaries);
98 void setLoginRequired(
bool z_loginRequired){m_loginRequired = z_loginRequired;};
99 void setShareSocket(
bool z_shareSocket){m_shareSocket = z_shareSocket;};
100 void setUpdateRate(uint8 z_rateSpecifier,
double z_interval);
101 inline void setVerbose(
bool z_verbose){m_verbose = z_verbose;};
102 inline void setVerboseLists(){m_verboseLists = TRUE;};
103 inline void setVerboseFile(FILE *z_verboseFile){m_verboseFile = z_verboseFile;};
104 void setEnableMerge(
bool z_enable);
106 void transact(
mc_data *z_transaction);
107 void change_priority(sint16 z_increment, uint8 * z_old_priority);
113 void add(
mc_data *z_data, ENUM_MCUpdateIntervals z_frequency);
118 double m_highPriorityInterval;
119 double m_mediumPriorityInterval;
120 double m_lowPriorityInterval;
121 double m_highPriorityListStartTicks;
122 double m_mediumPriorityListStartTicks;
123 double m_lowPriorityListStartTicks;
124 bool m_processingHighPriorityList;
125 bool m_processingMediumPriorityList;
126 bool m_processingLowPriorityList;
129 char m_addressOrName[104];
130 char m_lastAddressOrName[104];
131 uint8 m_modbusAddress;
136 uint16 m_workingRetries;
138 uint16 *m_boundaries;
139 sint16 m_deviceNumber;
142 bool m_loginRequired;
149 static uint8 s_priority;
150 static uint16 s_stack;
151 SEM_ID m_enableChangeSemaphore;
153 ENUM_MCStatus m_lastStatus;
176 static uint16 m_numberOfDevices;
Definition: mc_dataList.h:20
Definition: mc_deviceRunnable.h:29