SysIo  1.9.0
Embedded Library and tools
tinfo.h
1 
8 #ifndef _SYSIO_TINFO_H_
9 #define _SYSIO_TINFO_H_
10 
11 #include <sysio/defs.h>
12 #ifdef __cplusplus
13  extern "C" {
14 #endif
15 /* ========================================================================== */
16 #include <errno.h>
17 #include <stdio.h>
18 #include <time.h>
19 
43 /* constants ================================================================ */
50 typedef enum {
52  eTinfoFrameBlue = 0x0001,
54 #ifndef __DOXYGEN__
55  /* Réservé pour évolution future */
56  eTinfoFrameYellow = 0x0002,
57  eTinfoFrameIce = 0x0004,
58  eTinfoFrameIce2Q = eTinfoFrameIce,
59  eTinfoFrameIce4Q = eTinfoFrameIce + 0x0008,
60  eTinfoFramePmePmi = 0x0010,
61  eTinfoFrameSaphir = 0x0020,
62 #endif /* __DOXYGEN__ not defined */
63 } eTinfoFrame;
64 
68 typedef enum {
75 
79 typedef enum {
80  eTinfoFlagShort = 0x0001,
81  eTinfoFlagPapp = 0x0002,
82  eTinfoFlagAdps = 0x0100,
83  eTinfoFlagNewPtec = 0x0200,
86 } eTinfoFlag;
87 
91 typedef enum {
92  eTinfoPtecUnknown = 0,
104 } eTinfoPtec;
105 
109 typedef enum {
110  eTinfoColorUnknown = 0,
115 
119 typedef enum {
125 #ifndef __DOXYGEN__
126 #define TINFO_CB_FIRST eTinfoCbFrame
127 #define TINFO_CB_LAST eTinfoCbTempo
128 #endif /* __DOXYGEN__ not defined */
129 } eTinfoCbType;
130 
131 /* structures =============================================================== */
132 
136 struct xTinfoBase {
137  unsigned long index;
138 };
139 
143 struct xTinfoHc {
144  unsigned long index_hc;
145  unsigned long index_hp;
146  char horaire;
147 };
148 
152 struct xTinfoTempo {
153  unsigned long index_hcjb;
154  unsigned long index_hpjb;
155  unsigned long index_hcjw;
156  unsigned long index_hpjw;
157  unsigned long index_hcjr;
158  unsigned long index_hpjr;
159  eTinfoTempoColor demain;
160  char pgm1;
161  char pgm2;
162 };
163 
167 struct xTinfoEjp {
168  unsigned long index_hn;
169  unsigned long index_hpm;
170  unsigned pejp;
171 };
172 
178 union uTinfoTarif {
179  struct xTinfoBase base;
180  struct xTinfoHc hc;
181  struct xTinfoTempo tempo;
182  struct xTinfoEjp ejp;
183 };
184 
190  time_t time;
192  unsigned long long adco;
193  eTinfoOpTarif optarif;
194  eTinfoPtec ptec;
195  unsigned isousc;
196  unsigned nph;
197  unsigned iinst[3];
198  unsigned adps;
199  unsigned imax[3];
200  unsigned pmax;
201  unsigned papp;
202  unsigned motdetat;
203  unsigned ppot;
204  union uTinfoTarif tarif;
205 };
206 
213  time_t time;
215  unsigned long adco;
216  unsigned nph;
217  unsigned iinst[3];
218  unsigned adir[3];
219 };
220 
227  time_t time;
228  uint8_t raw[1];
229 };
230 
237 typedef union xTinfoFrame {
238 
239  struct xTinfoFrameBlue blue;
240  struct xTinfoFrameBlueShort blue_short;
242 } xTinfoFrame;
243 
249 typedef struct xTinfo xTinfo;
250 
251 
252 /* types ==================================================================== */
260 typedef int (*iTinfoCb) (struct xTinfo *tinfo, union xTinfoFrame *frame);
261 
262 /* internal public functions ================================================ */
272 xTinfo * xTinfoOpen (const char * port, unsigned long baudrate);
273 
282 int iTinfoPoll (xTinfo *tinfo);
283 
289 int iTinfoClose (xTinfo *tinfo);
290 
299 void vTinfoSetCB (xTinfo *tinfo, eTinfoCbType type, iTinfoCb cb);
300 
311 void * pvTinfoGetUserContext (const xTinfo *tinfo);
312 
323 void vTinfoSetUserContext (xTinfo *tinfo, void * udata);
324 
345 const char * sTinfoPtecToStr (eTinfoPtec ptec);
346 
359 const char * sTinfoTempoColorToStr (eTinfoTempoColor color);
360 
374 const char * sTinfoOpTarifToStr (eTinfoOpTarif tarif);
375 
380 /* ========================================================================== */
381 #ifdef __cplusplus
382  }
383 #endif
384 #endif /* _SYSIO_TINFO_H_ defined */
eTinfoFrame frame
Definition: tinfo.h:226
unsigned pmax
Definition: tinfo.h:200
eTinfoOpTarif optarif
Definition: tinfo.h:193
int iTinfoClose(xTinfo *tinfo)
Fermeture d&#39;une liaison de télé-information.
unsigned long index_hcjw
Definition: tinfo.h:155
struct xTinfo xTinfo
Contexte d&#39;une liaison de télé-information.
Definition: tinfo.h:249
char horaire
Definition: tinfo.h:146
unsigned pejp
Definition: tinfo.h:170
unsigned motdetat
Definition: tinfo.h:202
unsigned long index_hn
Definition: tinfo.h:168
int(* iTinfoCb)(struct xTinfo *tinfo, union xTinfoFrame *frame)
Prototype d&#39;un gestionnaire de réception.
Definition: tinfo.h:260
eTinfoPtec ptec
Definition: tinfo.h:194
eTinfoFlag
Drapeaux de la trame.
Definition: tinfo.h:79
unsigned long index_hpjr
Definition: tinfo.h:158
Données de la trame spécifiques à l&#39;option Heures creuses.
Definition: tinfo.h:143
eTinfoPtec
Période Tarifaire En Cours.
Definition: tinfo.h:91
Données de la trame spécifiques à option EJP.
Definition: tinfo.h:167
eTinfoCbType
Type de gestionnaire de réception.
Definition: tinfo.h:119
unsigned ppot
Definition: tinfo.h:203
void * pvTinfoGetUserContext(const xTinfo *tinfo)
Renvoie le pointeur sur les données de l&#39;utilisateur.
unsigned adps
Definition: tinfo.h:198
Données de la trame spécifiques à une option de tarification.
Definition: tinfo.h:178
void vTinfoSetUserContext(xTinfo *tinfo, void *udata)
Modifie le contexte utilisateur.
int raw(bool state)
Activation mode raw de l&#39;entrée standard L&#39;activation du mode raw désactive l&#39;attente d&#39;un ENTER pour...
Trame brute Permet de tester le type de trame.
Definition: tinfo.h:225
eTinfoFrame frame
Definition: tinfo.h:212
eTinfoTempoColor demain
Definition: tinfo.h:159
Trame de télé-information.
Definition: tinfo.h:237
Trame courte d&#39;un compteur bleu triphasé Emise lors d&#39;un dépassement d&#39;intensité souscrite sur une ou...
Definition: tinfo.h:211
eTinfoFlag flag
Definition: tinfo.h:214
int iTinfoPoll(xTinfo *tinfo)
Scrute la liaison de télé-information en attente de réception d&#39;octet.
unsigned long index_hc
Definition: tinfo.h:144
unsigned long index_hpjw
Definition: tinfo.h:156
eTinfoOpTarif
Option de tarification.
Definition: tinfo.h:68
union xTinfoFrame xTinfoFrame
Trame de télé-information.
Données de la trame spécifiques à option Tempo.
Definition: tinfo.h:152
const char * sTinfoOpTarifToStr(eTinfoOpTarif tarif)
Chaîne de caractère correspondant à une option tarifaire.
Données de la trame spécifiques à l&#39;option de base.
Definition: tinfo.h:136
unsigned long adco
Definition: tinfo.h:215
unsigned nph
Definition: tinfo.h:196
unsigned long long adco
Definition: tinfo.h:192
unsigned long index_hp
Definition: tinfo.h:145
char pgm1
Definition: tinfo.h:160
eTinfoFlag flag
Definition: tinfo.h:191
unsigned nph
Definition: tinfo.h:216
eTinfoFrame frame
Definition: tinfo.h:189
unsigned isousc
Definition: tinfo.h:195
char pgm2
Definition: tinfo.h:161
eTinfoFrame
Type de trame.
Definition: tinfo.h:50
unsigned long index_hcjr
Definition: tinfo.h:157
eTinfoTempoColor
Couleur Tempo.
Definition: tinfo.h:109
const char * sTinfoTempoColorToStr(eTinfoTempoColor color)
Chaîne de caractère correspondant à une couleur Tempo.
void vTinfoSetCB(xTinfo *tinfo, eTinfoCbType type, iTinfoCb cb)
Modifie un gestionnaire de réception.
time_t time
Definition: tinfo.h:227
unsigned long index_hcjb
Definition: tinfo.h:153
const char * sTinfoPtecToStr(eTinfoPtec ptec)
Chaîne de caractère correspondant à une période de tarification.
unsigned papp
Definition: tinfo.h:201
Trame d&#39;un compteur bleu.
Definition: tinfo.h:188
xTinfo * xTinfoOpen(const char *port, unsigned long baudrate)
Ouverture d&#39;une liaison de télé-information.
unsigned long index_hpjb
Definition: tinfo.h:154
unsigned long index
Definition: tinfo.h:137
time_t time
Definition: tinfo.h:190
unsigned long index_hpm
Definition: tinfo.h:169