| 1 |
// format dfescription: https://www.omg.org/spec/IDL/4.2/PDF |
| 2 |
|
| 3 |
// Adapted from net_fdm.hxx |
| 4 |
module FG |
| 5 |
{ |
| 6 |
|
| 7 |
// defining it this way also generates accompanying #defines in the header file. |
| 8 |
const octet DDS_PROP_VERSION = 0; |
| 9 |
const short DDS_PROP_REQUEST = -1; |
| 10 |
const char DDS_MODE_READ = 0; |
| 11 |
const char DDS_MODE_WRITE = 1; |
| 12 |
|
| 13 |
enum propType |
| 14 |
{ |
| 15 |
DDS_NONE, // The node hasn't been assigned a value yet |
| 16 |
DDS_ALIAS, // The node "points" to another node |
| 17 |
DDS_BOOL, |
| 18 |
DDS_INT, // 32-bit integer |
| 19 |
DDS_LONG, // 64-bit integer |
| 20 |
DDS_FLOAT, // 32-bit floating point number |
| 21 |
DDS_DOUBLE, // 64-bit floating point number |
| 22 |
DDS_STRING, // UTF-8 string |
| 23 |
DDS_UNSPECIFIED // Resolves to STRING |
| 24 |
}; |
| 25 |
|
| 26 |
union propValue switch ( propType ) |
| 27 |
{ |
| 28 |
case DDS_BOOL: |
| 29 |
char Bool; |
| 30 |
|
| 31 |
case DDS_NONE: |
| 32 |
case DDS_INT: |
| 33 |
long Int32; |
| 34 |
|
| 35 |
case DDS_LONG: |
| 36 |
long long Int64; |
| 37 |
|
| 38 |
case DDS_FLOAT: |
| 39 |
float Float32; |
| 40 |
|
| 41 |
case DDS_DOUBLE: |
| 42 |
double Float64; |
| 43 |
|
| 44 |
case DDS_ALIAS: |
| 45 |
case DDS_STRING: |
| 46 |
case DDS_UNSPECIFIED: |
| 47 |
string String; |
| 48 |
}; |
| 49 |
|
| 50 |
// Initial property request sequence |
| 51 |
// for properties where the id is not yet known: |
| 52 |
// 1. Set id to FG_DDS_PROP_REQUEST |
| 53 |
// 2. Set version to FG_DDS_PROP_VERSION |
| 54 |
// 3. Set mode to FG_DDS_MODE_READ |
| 55 |
// 4. set guid to the 16-char participants GUID |
| 56 |
// 5. Set val type to FG_DDS_STRING |
| 57 |
// 6. Set val String to the propery path |
| 58 |
// 7. Send the package. |
| 59 |
// |
| 60 |
// 8. Wait for an answer |
| 61 |
// * Check whether guid matches the participants GUID. |
| 62 |
// * The index of the requested propery path is stored in the id variable |
| 63 |
// which should be used by successive request as the id for that property. |
| 64 |
// * The val union holds the value of the propery. |
| 65 |
// |
| 66 |
// Successive property request sequence: |
| 67 |
// 1. Make sure id is to the id of the requested property |
| 68 |
// 2. Make sure version is to FG_DDS_PROP_VERSION |
| 69 |
// 3. Set mode to FG_DDS_MODE_READ or FG_DDS_MODE_WRITE |
| 70 |
// 3a. Optionally set the val union to match the property to overwrite. |
| 71 |
// 4. Send the package. |
| 72 |
// |
| 73 |
// 5. Wait for an answer |
| 74 |
// * Check whether id matches the requested property id. |
| 75 |
// * The val union holds the value of the propery. |
| 76 |
struct DDS_prop |
| 77 |
{ |
| 78 |
long id; // 32-bit property index and DDS id. |
| 79 |
octet version; // 8-bit sample-type version number. |
| 80 |
|
| 81 |
char mode; // FG_DDS_MODE_READ or FG_DDS_MODE_WRITE |
| 82 |
propValue val; // property value or path. |
| 83 |
|
| 84 |
// A sequence could be used here but unfortunatelly it's initializer |
| 85 |
// already is 10-bytes in size. |
| 86 |
octet guid[16]; |
| 87 |
}; |
| 88 |
#pragma keylist DDS_prop id |
| 89 |
|
| 90 |
}; // module FG |