diff --git a/src/Network/DDS/CMakeLists.txt b/src/Network/DDS/CMakeLists.txt index b96b64e60..745238150 100644 --- a/src/Network/DDS/CMakeLists.txt +++ b/src/Network/DDS/CMakeLists.txt @@ -22,4 +22,13 @@ add_executable(fg_dds_log ) setup_fgfs_libraries(fg_dds_log) +add_executable(fg_dds_prop + WIN32 + MACOSX_BUNDLE + fg_dds_prop.cpp + ${SOURCES} +) +setup_fgfs_libraries(fg_dds_prop) + + flightgear_component(Network "${SOURCES}" "${HEADERS}") diff --git a/src/Network/DDS/dds_props.c b/src/Network/DDS/dds_props.c index 79ef5628d..413c5f67e 100644 --- a/src/Network/DDS/dds_props.c +++ b/src/Network/DDS/dds_props.c @@ -17,6 +17,7 @@ static const dds_key_descriptor_t FG_DDS_PROP_keys[1] = static const uint32_t FG_DDS_PROP_ops [] = { DDS_OP_ADR | DDS_OP_TYPE_4BY | DDS_OP_FLAG_SGN | DDS_OP_FLAG_KEY, offsetof (FG_DDS_PROP, id), + DDS_OP_ADR | DDS_OP_TYPE_ARR | DDS_OP_SUBTYPE_1BY, offsetof (FG_DDS_PROP, guid), 16, DDS_OP_ADR | DDS_OP_TYPE_4BY | DDS_OP_FLAG_SGN, offsetof (FG_DDS_PROP, type), DDS_OP_ADR | DDS_OP_TYPE_UNI | DDS_OP_SUBTYPE_4BY | DDS_OP_FLAG_SGN, offsetof (FG_DDS_PROP, val._d), 9u, (31u << 16) + 4u, DDS_OP_JEQ | DDS_OP_TYPE_BOO | 0, FG_DDS_BOOL, offsetof (FG_DDS_PROP, val._u.Bool), @@ -28,7 +29,6 @@ static const uint32_t FG_DDS_PROP_ops [] = DDS_OP_JEQ | DDS_OP_TYPE_STR | 0, FG_DDS_ALIAS, offsetof (FG_DDS_PROP, val._u.String), DDS_OP_JEQ | DDS_OP_TYPE_STR | 0, FG_DDS_STRING, offsetof (FG_DDS_PROP, val._u.String), DDS_OP_JEQ | DDS_OP_TYPE_STR | 0, FG_DDS_UNSPECIFIED, offsetof (FG_DDS_PROP, val._u.String), - DDS_OP_ADR | DDS_OP_TYPE_STR, offsetof (FG_DDS_PROP, guid), DDS_OP_RTS }; @@ -42,5 +42,5 @@ const dds_topic_descriptor_t FG_DDS_PROP_desc = FG_DDS_PROP_keys, 14, FG_DDS_PROP_ops, - "" + "" }; diff --git a/src/Network/DDS/dds_props.h b/src/Network/DDS/dds_props.h index eab4fa324..5985daf1f 100644 --- a/src/Network/DDS/dds_props.h +++ b/src/Network/DDS/dds_props.h @@ -56,9 +56,9 @@ typedef struct FG_propValue typedef struct FG_DDS_PROP { int32_t id; + uint8_t guid[16]; FG_propType type; FG_propValue val; - char * guid; } FG_DDS_PROP; extern const dds_topic_descriptor_t FG_DDS_PROP_desc; diff --git a/src/Network/DDS/dds_props.idl b/src/Network/DDS/dds_props.idl index 02716fd93..dd59a3e18 100644 --- a/src/Network/DDS/dds_props.idl +++ b/src/Network/DDS/dds_props.idl @@ -75,10 +75,10 @@ struct DDS_PROP { long id; // property index and DDS id + octet guid[16]; + propType type; propValue val; - - string guid; // requesters globally unique identifier }; #pragma keylist DDS_PROP id diff --git a/src/Network/DDS/fg_dds_log.cpp b/src/Network/DDS/fg_dds_log.cpp index 917ee20bf..0102a05a8 100644 --- a/src/Network/DDS/fg_dds_log.cpp +++ b/src/Network/DDS/fg_dds_log.cpp @@ -113,47 +113,45 @@ int main() if (topics["prop"]->read()) { printf("=== [fg_dds_log] Received : "); - printf("PROP Message:\n"); - printf(" type: "); - switch(prop.type) + printf("Prop Message:\n"); + if (prop.id == FG_DDS_PROP_REQUEST) { + printf(" request: %s\n", prop.val._u.String); + printf("GUID: "); + for(int i=0; i<16; ++i) + printf("%X ", prop.guid[i]); + printf("\n"); + } + else { - case FG_DDS_NONE: - printf(" type: none"); - break; - case FG_DDS_ALIAS: - printf(" type: alias"); - printf(" value: %s\n", prop.val._u.String); - break; - case FG_DDS_BOOL: - printf(" type: bool"); - printf(" value: %i\n", prop.val._u.Bool); - break; - case FG_DDS_INT: - printf(" type: int"); - printf(" value: %i\n", prop.val._u.Int32); - break; - case FG_DDS_LONG: - printf(" type: long"); - printf(" value: %li\n", prop.val._u.Int64); - break; - case FG_DDS_FLOAT: - printf(" type: float"); - printf(" value: %f\n", prop.val._u.Float32); - break; - case FG_DDS_DOUBLE: - printf(" type: double"); - printf(" value: %lf\n", prop.val._u.Float64); - break; - case FG_DDS_STRING: - printf(" type: string"); - printf(" value: %s\n", prop.val._u.String); - break; - case FG_DDS_UNSPECIFIED: - printf(" type: unspecified"); - printf(" value: %s\n", prop.val._u.String); - break; - default: - break; + switch(prop.val._d) + { + case FG_DDS_BOOL: + printf(" type: bool"); + printf(" value: %i\n", prop.val._u.Bool); + break; + case FG_DDS_INT: + printf(" type: int"); + printf(" value: %i\n", prop.val._u.Int32); + break; + case FG_DDS_LONG: + printf(" type: long"); + printf(" value: %li\n", prop.val._u.Int64); + break; + case FG_DDS_FLOAT: + printf(" type: float"); + printf(" value: %f\n", prop.val._u.Float32); + break; + case FG_DDS_DOUBLE: + printf(" type: double"); + printf(" value: %lf\n", prop.val._u.Float64); + break; + case FG_DDS_STRING: + printf(" type: string"); + printf(" value: %s\n", prop.val._u.String); + break; + default: + break; + } } }