summaryrefslogtreecommitdiff
path: root/cesar/maximus/phy/inc/PhySciMsg.h
blob: e08348c52786070d00a901e716153f5d11ffa30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
/************************************************************************
                        PhySciMsg.h - Copyright buret

Here you can write a license for your code, some comments or any other
information you want to have in your generated code. To to this simply
configure the "headings" directory in uml to point to a directory
where you have your heading files.

or you can just replace the contents of this file with your own.
If you want to do this, this file is located at

/usr/share/apps/umbrello/headings/heading.h

-->Code Generators searches for heading files based on the file extension
   i.e. it will look for a file name ending in ".h" to include in C++ header
   files, and for a file name ending in ".java" to include in all generated
   java code.
   If you name the file "heading.<extension>", Code Generator will always
   choose this file even if there are other files with the same extension in the
   directory. If you name the file something else, it must be the only one with that
   extension in the directory to guarantee that Code Generator will choose it.

you can use variables in your heading files which are replaced at generation
time. possible variables are : author, date, time, filename and filepath.
just write %variable_name%

This file was generated on %date% at %time%
The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhySciMsg.h
**************************************************************************/

#ifndef PHYSCIMSG_H
#define PHYSCIMSG_H

#include "SciMsg.h"

#include "phy_types.h"
#include "hal_phy_types.h"
#include "networkclock_types.h"


class IPhy;


/**
  * class PhySciMsg
  */

class PhySciMsg : public SciMsg
{

public:

  // public attributes
  //  

private:

  // private attributes
  //  

protected:

  // protected attributes
  //  

  // Get from specialized SCI msg header
  //
  Phy_Type mSpecializedSciMsgType;
  Phy_Mpdu_Format mMpduFormat;
  Phy_Nb_Of_Pbs mNbOfPbs;
  unsigned short int mNbOfMsgs;
  Phy_Fc_Mode mFcMode;
  Phy_Short_Ppdu mShortPpdu;
  Phy_Mod mMod;
  Phy_Fecrate mFecrate;
  Phy_Gil mGil;
  Phy_Tonemap_Index mTonemapIndex;
  Phy_Tx_Id mTxId;
  Phy_Flags mFlags;
  bool mIsEncrypted;
  bool mIsCrcOk;
  unsigned short int mPbSize;
  unsigned short int mReserved; // NOT USED YET
  Phy_Nb_Of_Symbols mNbOfSymbols;
  uint32_t mIvArray[3];
  uint32_t mNekArray[4];
  uint32_t mPbMeasurementArray[PHY_PB_MAX_NB];
  uint32_t mPbHeaderArray[PHY_PB_MAX_NB];

  // Specialized SCI msg header
  //
  Phy_Header mSpecializedSciMsgHeader;

  IPhy * mpPhyProcessor;

  bool mIsSent;

public:

  // Constructors/Destructors
  //  

  /**
   * Constructor
   */
  PhySciMsg ( IPhy * p_phy_processor );

  /**
   * Empty Destructor
   */
  virtual ~PhySciMsg ( );

  // public methods
  //

  /**
   * Creates a PHY SCI message.
   * @return SciMsg *
   */
  SciMsg * create ( ) const;

  /**
   * Handles a received PHY SCI message.
   * @return bool
   */
  bool dispatchMsg ( );

  /**
   * When receiving a PHY SCI message,
   * extracts the PHY SCI message header from the received SCI message data. 
   * @return bool
   */
  bool identifySpecializedSciMsgHeader ( );

  /**
   * Checks that software versions are compatible,
   * i.e. checks specialized SCI msg compatibility (check specialized SCI msg version).
   * @return bool
   */
  bool checkCompatibility ( ) const; 

  /**
   * Checks PHY SCI message header values ranges,
   * i.e. checks specialized SCI msg validity (check specialized SCI msg header coherence).
   * @return bool
   */
  bool checkValidity ( ) const; 

  /**
   * Displays the PHY SCI message header contents.
   */
  void displaySpecializedSciMsgHeader ( ) const;

  /**
   * Display the specialized SCI message type.
   */
  void displaySpecializedSciMsgType ( int log_level ) const;

  /**
   * Sets the PHY SCI message attributes before transmission.
   * @param  clock_id ID of the Network Clock event received message
   * @return bool
   */
  virtual bool prepare ( Network_Clock_Id clock_id = 0 );

  // public attribute accessor methods
  //  

  // private attribute accessor methods
  //  

  // protected attribute accessor methods
  //  

  /**
   * Gets a pointer to the PHY SCI message header.
   * @return mSpecializedSciMsgHeader into a void pointer
   */
  void * returnSpecializedSciMsgHeader ( ) const;

  /**
   * Gets the PHY SCI message header.
   * @return mSpecializedSciMsgHeader
   */
  const Phy_Header & getSpecializedSciMsgHeader ( ) const;

  /**
   * Sets the value of the PHY SCI message header.
   * @return bool
   * @param  specialized_sci_msg_header the new value of mSpecializedSciMsgHeader
   */
  bool setSpecializedSciMsgHeader ( const Phy_Header & specialized_sci_msg_header );

  /**
   * Gets a pointer to the PHY processor.
   * @return mpPhyProcessor
   */
  IPhy * getPhyProcessor ( ) const;

  /**
   * Gets the PHY SCI message type.
   * @return mSpecializedSciMsgType
   */
  Phy_Type getSpecializedSciMsgType ( ) const;

  /**
   * Sets the PHY SCI message type.
   * @return bool
   * @param  type the new value of mSpecializedSciMsgType
   */
  bool setSpecializedSciMsgType ( const Phy_Type type );

  /**
   * Gets the PHY SCI message MPDU format.
   * @return mMpduFormat
   */
  Phy_Mpdu_Format getMpduFormat ( ) const; 

  /**
   * Sets the PHY SCI message MPDU format.
   * @return bool
   * @param  mpdu_format the new value of mMpduFormat
   */
  bool setMpduFormat ( const Phy_Mpdu_Format mpdu_format );

  /**
   * Gets the PHY SCI message PB number.
   * @return mNbOfPbs
   */
  Phy_Nb_Of_Pbs getNbOfPbs ( ) const;

  /**
   * Sets the PHY SCI message PB number.
   * @return bool
   * @param  nb_of_pbs the new value of mNbOfPbs
   */
  bool setNbOfPbs ( const Phy_Nb_Of_Pbs nb_of_pbs );

  /**
   * Gets the number of PHY SCI messages (composing the MPDU).
   * @return mNbOfMsgs
   */
  unsigned short int getNbOfMsgs ( ) const;

  /**
   * Sets the number of PHY SCI messages (composing the MPDU).
   * @param  nb_of_msgs the new value of mNbOfMsgs
   * @return bool
   */
  bool setNbOfMsgs ( const unsigned short int nb_of_msgs );

  /**
   * Sets the PHY SCI message Frame Control mode.
   * @return mFcMode
   */
  Phy_Fc_Mode getFcMode ( ) const;

  /**
   * Sets the PHY SCI message Frame Control mode.
   * @return bool
   * @param  fc_mode the new value of mFcMode
   */
  virtual bool setFcMode ( const Phy_Fc_Mode fc_mode );

  /**
   * Gets the PHY SCI message short PPDU.
   * @return mShortPpdu
   */
  Phy_Short_Ppdu getShortPpdu ( ) const;

  /**
   * Sets the PHY SCI message short PPDU.
   * @return bool
   * @param  short_ppdu the new value of mShortPpdu
   */
  virtual bool setShortPpdu ( const Phy_Short_Ppdu short_ppdu );

  /**
   * Gets the PHY SCI message modulation.
   * @return mMod
   */
  Phy_Mod getMod ( ) const;

  /**
   * Sets the PHY SCI message modulation.
   * @return bool
   * @param  mod the new value of mMod
   */
  virtual bool setMod ( const Phy_Mod mod );

  /**
   * Gets the PHY SCI message FEC rate.
   * @return mFecrate
   */
  Phy_Fecrate getFecrate ( ) const;

  /**
   * Sets the PHY SCI message FEC rate.
   * @return bool
   * @param  fecrate the new value of mFecrate
   */
  virtual bool setFecrate ( const Phy_Fecrate fecrate );

  /**
   * Gets the PHY SCI message Guard Interval.
   * @return mGil
   */
  Phy_Gil getGil ( ) const;

  /**
   * Sets the PHY SCI message Guard Interval.
   * @return bool
   * @param  gil the new value of mGil
   */
  virtual bool setGil ( const Phy_Gil gil );

  /**
   * Gets the PHY SCI message tonemap index.
   * @return mTonemapIndex
   */
  Phy_Tonemap_Index getTonemapIndex ( ) const;

  /**
   * Sets the PHY SCI message tonemap index.
   * @return bool
   * @param  tonemap_index the new value of mTonemapIndex
   */
  bool setTonemapIndex ( const Phy_Tonemap_Index tonemap_index );

  /**
   * Sets the PHY SCI message transmission ID.
   * @return mTxId
   */
  Phy_Tx_Id getTxId ( ) const;

  /**
   * Gets the PHY SCI message transmission ID.
   * @return bool
   * @param  tx_id the new value of mTxId
   */
  bool setTxId ( const Phy_Tx_Id tx_id );

  /**
   * Gets the PHY SCI message flags.
   * @return mFlags
   */
  Phy_Flags getFlags ( ) const;

  /**
   * Sets the PHY SCI message flags.
   * @return bool
   * @param  flags the new value of mFlags
   */
  virtual bool setFlags ( const Phy_Flags flags );

  /**
   * Gets if the PHY SCI message is encrypted or not.
   * @return mIsEncrypted
   */
  bool isEncrypted ( ) const;

  /**
   * Sets if the PHY SCI message is encrypted or not.
   * @return bool
   * @param  is_encrypted the new value of mIsEncrypted
   */
  bool setIsEncrypted ( const bool is_encrypted );

  /**
   * Gets if the PHY SCI message CRC is OK or not.
   * @return mIsCrcOk
   */
  bool isCrcOk ( ) const;

  /**
   * Sets if the PHY SCI message CRC is OK or not.
   * @return bool
   * @param  is_crc_ok the new value of mIsCrcOk
   */
  bool setIsCrcOk ( const bool is_crc_ok );

  /**
   * Gets the PHY SCI message PB size.
   * @return mPbSize
   */
  unsigned short int getPbSize ( ) const;

  /**
   * Sets the PHY SCI message PB size.
   * @return bool
   * @param  pb_size the new value of mPbSize
   */
  bool setPbSize ( const unsigned short int pb_size );

  /**
   * Sets the PHY SCI message reserved field (NOT USED YET).
   * @return mReserved
   */
  inline unsigned short int getReserved ( ) const { return mReserved;  }

  /**
   * Sets the PHY SCI message reserved field (NOT USED YET).
   * @return bool
   * @param  reserved the new value of mReserved
   */
  inline bool setReserved ( const unsigned short int reserved ) { mReserved = reserved;
                                                                  return true;  }

  /**
   * Gets the PHY SCI message symbols number.
   * @return mNbOfSymbols
   */
  Phy_Nb_Of_Symbols getNbOfSymbols ( ) const;

  /**
   * Sets the PHY SCI message symbols number.
   * @return bool
   * @param  nb_of_symbols the new value of mNbOfSymbols
   */
  bool setNbOfSymbols ( const Phy_Nb_Of_Symbols nb_of_symbols );

  /**
   * Gets the PHY SCI message IV array.
   * @return mIvArray
   */
  const uint32_t * getIv ( ) const;

  /**
   * Sets the PHY SCI message IV array.
   * @return bool
   * @param  iv the new value of mIvArray
   */
  bool setIv ( const uint32_t iv[3] );

  /**
   * Gets the PHY SCI message NEK array.
   * @return mNekArray
   */
  const uint32_t * getNek ( ) const;

  /**
   * Sets the PHY SCI message NEK array.
   * @return bool
   * @param  nek the new value of mNekArray
   */
  bool setNek ( const uint32_t nek[4] );

  /**
   * Gets the PHY SCI message PB measurement array.
   * @return mPbMeasurementArray
   */
  const uint32_t * getPbMeasurement ( ) const;

  /**
   * Sets the PHY SCI message PB measurement array.
   * @return bool
   * @param  pb_measurement the new value of mPbMeasurementArray
   */
  bool setPbMeasurement ( const uint32_t pb_measurement[PHY_PB_MAX_NB] );

  /**
   * Gets the PHY SCI message PB header array.
   * @return mPbHeaderArray
   */
  const uint32_t * getPbHeader ( ) const;

  /**
   * @return bool
   * @param  pb_header the new value of mPbHeaderArray
   */
  bool setPbHeader ( const uint32_t pb_header[PHY_PB_MAX_NB] );

  /**
   * Checks if the PHY SCI message has been sent.
   * @return mIsSent
   */
   virtual bool isSent ( ) const;

  /**
   * Sets if the PHY SCI message has been sent.
   * @param  is_sent the new value of mIsSent
   * @return bool
   */
   bool setIsSent ( const bool is_sent );

private:

  // private methods
  //  

  /**
   * Initializes the PHY SCI message class attributes.
   */
  void initAttributes ( );

  /**
   * Displays the PHY SCI message header IV.
   */
  void displayIv ( ) const;

  /**
   * Displays the PHY SCI message header NEK.
   */
  void displayNek ( ) const;

  /**
   * Displays the PHY SCI message header PBs measurements.
   */
  void displayPbMeasurement ( ) const;

  /**
   * Displays the PHY SCI message header PBs headers.
   */
  void displayPbHeader ( ) const;

protected:

  // protected methods
  //  

};


#endif // PHYSCIMSG_H