diff --git a/EtsiClientGen/patches/applyPatches.sh b/EtsiClientGen/patches/applyPatches.sh index 5641ddd507a5668e6f1a57ccb816adc64689d944..482861723ed5f3d585035e4edae73586903b30fc 100755 --- a/EtsiClientGen/patches/applyPatches.sh +++ b/EtsiClientGen/patches/applyPatches.sh @@ -2,6 +2,7 @@ patch -u ../model/encoding_information_structure.c -i fixCEncodingInformationStructure.patch patch -u ../model/error.c -i fixCError.patch patch -u ../model/trackable.c -i fixCTrackable.patch +patch -u ../model/world_anchor.c -i fixCWorldAnchor.patch patch -u ../api/TrackablesAPI.c -i fixCTrackableAPI.patch patch -u ../model/trackable_type.c -i fixCTrackableType.patch patch -u ../api/WorldAnchorsAPI.c -i fixCWorldAnchorAPI.patch @@ -12,6 +13,10 @@ patch -u ../model/trackable.h -i fixHeaderTrackable.patch patch -u ../model/trackable_type.h -i fixHeaderTrackableType.patch patch -u ../model/unit_system.h -i fixHeaderUnitSystem.patch patch -u ../model/world_link.h -i fixHeaderWorldLink.patch +patch -u ../api/RelocalizationInformationAPI.c -i fixRelocalizationInformationAPI.patch +patch -u ../model/unit_system.c -i fixCUnitSystem.patch +patch -u ../model/type_world_storage.c -i fixCTypeWorldStorage.patch +patch -u ../model/type_world_storage.h -i fixHeaderTypeWorldStorage.patch diff --git a/EtsiClientGen/patches/fixCEncodingInformationStructure.patch b/EtsiClientGen/patches/fixCEncodingInformationStructure.patch index d9314829fcd391aa4f8c27db34a11a0d393f38e3..e47fa0816d2e81ab8c40e83e383cf4601270e481 100644 --- a/EtsiClientGen/patches/fixCEncodingInformationStructure.patch +++ b/EtsiClientGen/patches/fixCEncodingInformationStructure.patch @@ -1,6 +1,8 @@ ---- encoding_information_structure_origin.c 2024-05-28 14:41:34.817357145 +0200 -+++ encoding_information_structure.c 2024-05-22 18:34:03.566752000 +0200 -@@ -56,7 +56,7 @@ +diff --git a/EtsiClientGen/model/encoding_information_structure.c b/../../world-storage-c-client/EtsiClientGen/model/encoding_information_structure.c +index 1deb8f5..fb66a4f 100644 +--- a/EtsiClientGen/model/encoding_information_structure.c ++++ b/../../world-storage-c-client/EtsiClientGen/model/encoding_information_structure.c +@@ -56,7 +56,7 @@ cJSON *encoding_information_structure_convertToJSON(encoding_information_structu if (world_storage_api_encoding_information_structure_DATAFORMAT_NULL == encoding_information_structure->data_format) { goto fail; } diff --git a/EtsiClientGen/patches/fixCTrackable.patch b/EtsiClientGen/patches/fixCTrackable.patch index 8440edcb5616fda94e3e55d0672fc4a4c7fb3f2d..96bd0452a8708643b65fc7843bae0c5adbd822b1 100644 --- a/EtsiClientGen/patches/fixCTrackable.patch +++ b/EtsiClientGen/patches/fixCTrackable.patch @@ -1,5 +1,7 @@ ---- trackable_origin.c 2024-05-28 14:41:34.877357153 +0200 -+++ trackable.c 2024-05-22 18:50:02.874278000 +0200 +diff --git a/EtsiClientGen/model/trackable.c b/../../world-storage-c-client/EtsiClientGen/model/trackable.c +index 1a27417..f26b4d7 100644 +--- a/EtsiClientGen/model/trackable.c ++++ b/../../world-storage-c-client/EtsiClientGen/model/trackable.c @@ -3,42 +3,6 @@ #include #include "trackable.h" @@ -43,7 +45,15 @@ trackable_t *trackable_create( char *uuid, char *name, -@@ -162,10 +126,10 @@ +@@ -154,6 +118,7 @@ cJSON *trackable_convertToJSON(trackable_t *trackable) { + + // trackable->creator_uuid + if (!trackable->creator_uuid) { ++ + goto fail; + } + if(cJSON_AddStringToObject(item, "creatorUUID", trackable->creator_uuid) == NULL) { +@@ -162,18 +127,25 @@ cJSON *trackable_convertToJSON(trackable_t *trackable) { // trackable->trackable_type @@ -56,7 +66,41 @@ if(trackable_type_local_JSON == NULL) { goto fail; // custom } -@@ -217,10 +181,10 @@ +- cJSON_AddItemToObject(item, "trackableType", trackable_type_local_JSON); ++ ++ char *type_str = cJSON_GetStringValue(trackable_type_local_JSON); ++ if (type_str == NULL) { ++ goto fail; ++ } ++ if (cJSON_AddStringToObject(item, "trackableType", type_str) == NULL) { ++ goto fail; ++ } + if(item->child == NULL) { + goto fail; + } +- ++ + + // trackable->trackable_encoding_information + if (!trackable->trackable_encoding_information) { +@@ -188,14 +160,14 @@ cJSON *trackable_convertToJSON(trackable_t *trackable) { + goto fail; + } + +- ++/* + // trackable->trackable_payload + if (!trackable->trackable_payload) { + goto fail; + } + if(cJSON_AddStringToObject(item, "trackablePayload", trackable->trackable_payload) == NULL) { + goto fail; //ByteArray +- } ++ }*/ + + + // trackable->local_crs +@@ -217,14 +189,21 @@ cJSON *trackable_convertToJSON(trackable_t *trackable) { // trackable->unit @@ -66,19 +110,136 @@ } - cJSON *unit_local_JSON = unit_system_convertToJSON(trackable->unit); + cJSON *unit_local_JSON = unit_system_unit_system_convertToJSON(*trackable->unit); ++ if(unit_local_JSON == NULL) { goto fail; // custom } -@@ -342,7 +306,7 @@ +- cJSON_AddItemToObject(item, "unit", unit_local_JSON); ++ char *unit_str = cJSON_GetStringValue(unit_local_JSON); ++ if (unit_str == NULL) { ++ goto fail; ++ } ++ if (cJSON_AddStringToObject(item, "unit", unit_str) == NULL) { ++ goto fail; ++ } + if(item->child == NULL) { + goto fail; + } +@@ -243,11 +222,12 @@ cJSON *trackable_convertToJSON(trackable_t *trackable) { + list_ForEach(trackable_sizeListEntry, trackable->trackable_size) { + if(cJSON_AddNumberToObject(trackable_size, "", *(double *)trackable_sizeListEntry->data) == NULL) + { ++ + goto fail; + } + } + +- ++ /* + // trackable->keyvalue_tags + if (!trackable->keyvalue_tags) { + goto fail; +@@ -262,7 +242,7 @@ cJSON *trackable_convertToJSON(trackable_t *trackable) { + list_ForEach(keyvalue_tagsListEntry, trackable->keyvalue_tags) { + keyValuePair_t *localKeyValue = (keyValuePair_t*)keyvalue_tagsListEntry->data; + } +- } ++ }*/ + + + // trackable->confidence +@@ -305,12 +285,16 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ + // trackable->uuid + cJSON *uuid = cJSON_GetObjectItemCaseSensitive(trackableJSON, "UUID"); + if (uuid) { ++ + if(!cJSON_IsString(uuid) && !cJSON_IsNull(uuid)) ++ + { ++ + goto end; //String +- } ++ + } + ++ } + // trackable->name + cJSON *name = cJSON_GetObjectItemCaseSensitive(trackableJSON, "name"); + if (!name) { +@@ -322,7 +306,6 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ + { + goto end; //String + } +- + // trackable->creator_uuid + cJSON *creator_uuid = cJSON_GetObjectItemCaseSensitive(trackableJSON, "creatorUUID"); + if (!creator_uuid) { +@@ -334,7 +317,7 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ + { + goto end; //String + } +- ++ trackable_type_local_nonprim = (trackable_type_t *)malloc(sizeof(trackable_type_t)); + // trackable->trackable_type + cJSON *trackable_type = cJSON_GetObjectItemCaseSensitive(trackableJSON, "trackableType"); + if (!trackable_type) { +@@ -342,35 +325,38 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ } - trackable_type_local_nonprim = trackable_type_parseFromJSON(trackable_type); //custom +- + *trackable_type_local_nonprim = trackable_type_trackable_type_parseFromJSON(trackable_type); //custom - // trackable->trackable_encoding_information cJSON *trackable_encoding_information = cJSON_GetObjectItemCaseSensitive(trackableJSON, "trackableEncodingInformation"); -@@ -400,7 +364,7 @@ + if (!trackable_encoding_information) { + goto end; + } +- ++ + + trackable_encoding_information_local_nonprim = encoding_information_structure_parseFromJSON(trackable_encoding_information); //nonprimitive +- + // trackable->trackable_payload +- cJSON *trackable_payload = cJSON_GetObjectItemCaseSensitive(trackableJSON, "trackablePayload"); +- if (!trackable_payload) { ++ /* cJSON *trackable_payload = cJSON_GetObjectItemCaseSensitive(trackableJSON, "trackablePayload"); ++ ++ if (!trackable_payload) { + goto end; + } ++ ++ + + ++ + if(!cJSON_IsString(trackable_payload)) + { + goto end; //ByteArray +- } + ++ } ++*/ + // trackable->local_crs + cJSON *local_crs = cJSON_GetObjectItemCaseSensitive(trackableJSON, "localCRS"); + if (!local_crs) { + goto end; + } +- ++ + + cJSON *local_crs_local = NULL; + if(!cJSON_IsArray(local_crs)) { +@@ -392,15 +378,15 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ + *local_crs_local_value = local_crs_local->valuedouble; + list_addElement(local_crsList , local_crs_local_value); + } +- + // trackable->unit ++ unit_local_nonprim = (unit_system_t *)malloc(sizeof(unit_system_t)); + cJSON *unit = cJSON_GetObjectItemCaseSensitive(trackableJSON, "unit"); + if (!unit) { + goto end; } @@ -87,3 +248,60 @@ // trackable->trackable_size cJSON *trackable_size = cJSON_GetObjectItemCaseSensitive(trackableJSON, "trackableSize"); +@@ -429,7 +415,7 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ + *trackable_size_local_value = trackable_size_local->valuedouble; + list_addElement(trackable_sizeList , trackable_size_local_value); + } +- ++ /* + // trackable->keyvalue_tags + cJSON *keyvalue_tags = cJSON_GetObjectItemCaseSensitive(trackableJSON, "keyvalueTags"); + if (!keyvalue_tags) { +@@ -452,7 +438,7 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ + list_addElement(keyvalue_tagsList , localMapKeyPair); + } + } +- ++ */ + // trackable->confidence + cJSON *confidence = cJSON_GetObjectItemCaseSensitive(trackableJSON, "confidence"); + if (confidence) { +@@ -462,25 +448,24 @@ trackable_t *trackable_parseFromJSON(cJSON *trackableJSON){ + } + } + +- + trackable_local_var = trackable_create ( + uuid && !cJSON_IsNull(uuid) ? strdup(uuid->valuestring) : NULL, + strdup(name->valuestring), + strdup(creator_uuid->valuestring), + trackable_type_local_nonprim, + trackable_encoding_information_local_nonprim, +- strdup(trackable_payload->valuestring), ++ NULL,//strdup(trackable_payload->valuestring), + local_crsList, + unit_local_nonprim, + trackable_sizeList, +- keyvalue_tagsList, +- confidence ? confidence->valuedouble : 0 ++ NULL,//keyvalue_tagsList, ++ confidence ? confidence->valuedouble : 0.0 + ); + + return trackable_local_var; + end: + if (trackable_type_local_nonprim) { +- trackable_type_free(trackable_type_local_nonprim); ++ free(trackable_type_local_nonprim); + trackable_type_local_nonprim = NULL; + } + if (trackable_encoding_information_local_nonprim) { +@@ -497,7 +482,7 @@ end: + local_crsList = NULL; + } + if (unit_local_nonprim) { +- unit_system_free(unit_local_nonprim); ++ free(unit_local_nonprim); + unit_local_nonprim = NULL; + } + if (trackable_sizeList) { diff --git a/EtsiClientGen/patches/fixCTrackableAPI.patch b/EtsiClientGen/patches/fixCTrackableAPI.patch index e57127d8ba8a85f43b9b9503ae878ab6fa6726c7..4dcc5c07284b43c6a010d292fa9c10f7c50ec0f0 100644 --- a/EtsiClientGen/patches/fixCTrackableAPI.patch +++ b/EtsiClientGen/patches/fixCTrackableAPI.patch @@ -1,6 +1,65 @@ ---- TrackablesAPI_origin.c 2024-05-17 23:00:40.039961617 +0200 -+++ TrackablesAPI.c 2024-05-17 23:18:05.808565009 +0200 -@@ -151,16 +151,7 @@ +diff --git a/EtsiClientGen/api/TrackablesAPI.c b/../../world-storage-c-client/EtsiClientGen/api/TrackablesAPI.c +index f639313..e9b01f3 100644 +--- a/EtsiClientGen/api/TrackablesAPI.c ++++ b/../../world-storage-c-client/EtsiClientGen/api/TrackablesAPI.c +@@ -57,6 +57,8 @@ TrackablesAPI_addTrackable(apiClient_t *apiClient, trackable_t *trackable, char + list_addElement(localVarHeaderType,"text/plain"); //produces + list_addElement(localVarHeaderType,"application/json"); //produces + list_addElement(localVarContentType,"application/json"); //consumes ++ ++ + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, +@@ -68,25 +70,25 @@ TrackablesAPI_addTrackable(apiClient_t *apiClient, trackable_t *trackable, char + "POST"); + + // uncomment below to debug the error response +- //if (apiClient->response_code == 200) { ++ if (apiClient->response_code == 200) { + // printf("%s\n","OK, return the UUID of the Trackable defined by the world storage."); +- //} ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 201) { +- // printf("%s\n","Null response."); +- //} ++ if (apiClient->response_code == 201) { ++ printf("%s\n","Null response."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 400) { +- // printf("%s\n","Bad request."); +- //} ++ if (apiClient->response_code == 400) { ++ printf("%s\n","Bad request."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 409) { +- // printf("%s\n","Invalid UUID, id must be a Nil value."); +- //} ++ if (apiClient->response_code == 409) { ++ printf("%s\n","Invalid UUID, id must be a Nil value."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 0) { +- // printf("%s\n","Unexpected error."); +- //} ++ if (apiClient->response_code == 0) { ++ printf("%s\n","Unexpected error."); ++ } + //primitive return type simple + char* elementToReturn = strdup((char*)apiClient->dataReceived); + +@@ -95,7 +97,6 @@ TrackablesAPI_addTrackable(apiClient_t *apiClient, trackable_t *trackable, char + apiClient->dataReceived = NULL; + apiClient->dataReceivedLen = 0; + } +- + list_freeList(localVarHeaderParameters); + + list_freeList(localVarHeaderType); +@@ -151,16 +152,7 @@ TrackablesAPI_deleteTrackable(apiClient_t *apiClient, char *trackableUUID, char sprintf(localVarToReplace_trackableUUID, "{%s}", "trackableUUID"); localVarPath = strReplace(localVarPath, localVarToReplace_trackableUUID, trackableUUID); @@ -18,7 +77,7 @@ // header parameters char *keyHeader_token = NULL; char * valueHeader_token = 0; -@@ -255,15 +246,6 @@ +@@ -255,15 +247,6 @@ TrackablesAPI_getTrackableById(apiClient_t *apiClient, char *trackableUUID, char sprintf(localVarToReplace_trackableUUID, "{%s}", "trackableUUID"); localVarPath = strReplace(localVarPath, localVarToReplace_trackableUUID, trackableUUID); @@ -34,3 +93,46 @@ // header parameters char *keyHeader_token = NULL; +@@ -289,25 +272,25 @@ TrackablesAPI_getTrackableById(apiClient_t *apiClient, char *trackableUUID, char + "GET"); + + // uncomment below to debug the error response +- //if (apiClient->response_code == 200) { ++ if (apiClient->response_code == 200) { + // printf("%s\n","Successful operation."); +- //} ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 400) { +- // printf("%s\n","Invalid UUID supplied."); +- //} ++ if (apiClient->response_code == 400) { ++ printf("%s\n","Invalid UUID supplied."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 404) { +- // printf("%s\n","Not found, could not find UUID in database."); +- //} ++ if (apiClient->response_code == 404) { ++ printf("%s\n","Not found, could not find UUID in database."); ++ } + //nonprimitive not container + cJSON *TrackablesAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); ++ char *localVarJSONToChar = cJSON_Print(TrackablesAPIlocalVarJSON); + trackable_t *elementToReturn = trackable_parseFromJSON(TrackablesAPIlocalVarJSON); + cJSON_Delete(TrackablesAPIlocalVarJSON); + if(elementToReturn == NULL) { + // return 0; + } +- + //return type + if (apiClient->dataReceived) { + free(apiClient->dataReceived); +@@ -330,6 +313,7 @@ TrackablesAPI_getTrackableById(apiClient_t *apiClient, char *trackableUUID, char + valueHeader_token = NULL; + } + free(keyPairHeader_token); ++ + return elementToReturn; + end: + free(localVarPath); diff --git a/EtsiClientGen/patches/fixCTrackableType.patch b/EtsiClientGen/patches/fixCTrackableType.patch index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f7ae08c4be3b285b8fee838b46ad2fe96a6ff807 100644 --- a/EtsiClientGen/patches/fixCTrackableType.patch +++ b/EtsiClientGen/patches/fixCTrackableType.patch @@ -0,0 +1,30 @@ +diff --git a/EtsiClientGen/model/trackable_type.c b/../../world-storage-c-client/EtsiClientGen/model/trackable_type.c +index b8d748c..042a746 100644 +--- a/EtsiClientGen/model/trackable_type.c ++++ b/../../world-storage-c-client/EtsiClientGen/model/trackable_type.c +@@ -23,8 +23,8 @@ world_storage_api_trackable_type__e trackable_type_trackable_type_FromString(cha + } + + cJSON *trackable_type_trackable_type_convertToJSON(world_storage_api_trackable_type__e trackable_type) { +- cJSON *item = cJSON_CreateObject(); +- if(cJSON_AddStringToObject(item, "trackable_type", trackable_type_trackable_type_ToString(trackable_type)) == NULL) { ++ cJSON *item =cJSON_CreateString(trackable_type_trackable_type_ToString(trackable_type));; ++ if(item == NULL) { + goto fail; + } + return item; +@@ -36,11 +36,11 @@ fail: + world_storage_api_trackable_type__e trackable_type_trackable_type_parseFromJSON(cJSON *trackable_typeJSON) { + world_storage_api_trackable_type__e *trackable_type = NULL; + world_storage_api_trackable_type__e trackable_typeVariable; +- cJSON *trackable_typeVar = cJSON_GetObjectItemCaseSensitive(trackable_typeJSON, "trackable_type"); +- if(!cJSON_IsString(trackable_typeVar) || (trackable_typeVar->valuestring == NULL)){ ++ cJSON *trackable_typeVar = cJSON_GetObjectItemCaseSensitive(trackable_typeJSON, "trackableType"); ++ if(!cJSON_IsString(trackable_typeJSON)){ + goto end; + } +- trackable_typeVariable = trackable_type_trackable_type_FromString(trackable_typeVar->valuestring); ++ trackable_typeVariable = trackable_type_trackable_type_FromString(trackable_typeJSON->valuestring); + return trackable_typeVariable; + end: + return 0; diff --git a/EtsiClientGen/patches/fixCTypeWorldStorage.patch b/EtsiClientGen/patches/fixCTypeWorldStorage.patch new file mode 100644 index 0000000000000000000000000000000000000000..cab275713894c8d8bab89023b9a86f4df94f45a9 --- /dev/null +++ b/EtsiClientGen/patches/fixCTypeWorldStorage.patch @@ -0,0 +1,35 @@ +diff --git a/EtsiClientGen/model/type_world_storage.c b/../../world-storage-c-client/EtsiClientGen/model/type_world_storage.c +index b7bf318..9fb4529 100644 +--- a/EtsiClientGen/model/type_world_storage.c ++++ b/../../world-storage-c-client/EtsiClientGen/model/type_world_storage.c +@@ -23,8 +23,9 @@ world_storage_api_type_world_storage__e type_world_storage_type_world_storage_Fr + } + + cJSON *type_world_storage_type_world_storage_convertToJSON(world_storage_api_type_world_storage__e type_world_storage) { +- cJSON *item = cJSON_CreateObject(); +- if(cJSON_AddStringToObject(item, "type_world_storage", type_world_storage_type_world_storage_ToString(type_world_storage)) == NULL) { ++ cJSON *item = cJSON_CreateString(type_world_storage_type_world_storage_ToString(type_world_storage)); ++ if(item == NULL) { ++ + goto fail; + } + return item; +@@ -33,14 +34,14 @@ fail: + return NULL; + } + ++ ++ + world_storage_api_type_world_storage__e type_world_storage_type_world_storage_parseFromJSON(cJSON *type_world_storageJSON) { + world_storage_api_type_world_storage__e *type_world_storage = NULL; + world_storage_api_type_world_storage__e type_world_storageVariable; + cJSON *type_world_storageVar = cJSON_GetObjectItemCaseSensitive(type_world_storageJSON, "type_world_storage"); +- if(!cJSON_IsString(type_world_storageVar) || (type_world_storageVar->valuestring == NULL)){ +- goto end; +- } +- type_world_storageVariable = type_world_storage_type_world_storage_FromString(type_world_storageVar->valuestring); ++ ++ type_world_storageVariable = type_world_storage_type_world_storage_FromString(type_world_storageJSON->valuestring); + return type_world_storageVariable; + end: + return 0; diff --git a/EtsiClientGen/patches/fixCUnitSystem.patch b/EtsiClientGen/patches/fixCUnitSystem.patch new file mode 100644 index 0000000000000000000000000000000000000000..ff68c483a8cb991bb964ca4bdab8b9c9b9064625 --- /dev/null +++ b/EtsiClientGen/patches/fixCUnitSystem.patch @@ -0,0 +1,30 @@ +diff --git a/EtsiClientGen/model/unit_system.c b/../../world-storage-c-client/EtsiClientGen/model/unit_system.c +index 9840c00..38ba712 100644 +--- a/EtsiClientGen/model/unit_system.c ++++ b/../../world-storage-c-client/EtsiClientGen/model/unit_system.c +@@ -23,8 +23,8 @@ world_storage_api_unit_system__e unit_system_unit_system_FromString(char* unit_s + } + + cJSON *unit_system_unit_system_convertToJSON(world_storage_api_unit_system__e unit_system) { +- cJSON *item = cJSON_CreateObject(); +- if(cJSON_AddStringToObject(item, "unit_system", unit_system_unit_system_ToString(unit_system)) == NULL) { ++ cJSON *item = cJSON_CreateString(unit_system_unit_system_ToString(unit_system)); ++ if (item == NULL) { + goto fail; + } + return item; +@@ -36,11 +36,11 @@ fail: + world_storage_api_unit_system__e unit_system_unit_system_parseFromJSON(cJSON *unit_systemJSON) { + world_storage_api_unit_system__e *unit_system = NULL; + world_storage_api_unit_system__e unit_systemVariable; +- cJSON *unit_systemVar = cJSON_GetObjectItemCaseSensitive(unit_systemJSON, "unit_system"); +- if(!cJSON_IsString(unit_systemVar) || (unit_systemVar->valuestring == NULL)){ ++ cJSON *unit_systemVar = cJSON_GetObjectItemCaseSensitive(unit_systemJSON, "unit"); ++ if(!cJSON_IsString(unit_systemJSON)){ + goto end; + } +- unit_systemVariable = unit_system_unit_system_FromString(unit_systemVar->valuestring); ++ unit_systemVariable = unit_system_unit_system_FromString(unit_systemJSON->valuestring); + return unit_systemVariable; + end: + return 0; diff --git a/EtsiClientGen/patches/fixCWorldAnchor.patch b/EtsiClientGen/patches/fixCWorldAnchor.patch new file mode 100644 index 0000000000000000000000000000000000000000..444a62e9ac59095f4c52e6bb6afc5f2ab1ace48d --- /dev/null +++ b/EtsiClientGen/patches/fixCWorldAnchor.patch @@ -0,0 +1,107 @@ +diff --git a/EtsiClientGen/model/world_anchor.c b/../../world-storage-c-client/EtsiClientGen/model/world_anchor.c +index 5e8a79c..7af4a19 100644 +--- a/EtsiClientGen/model/world_anchor.c ++++ b/../../world-storage-c-client/EtsiClientGen/model/world_anchor.c +@@ -146,16 +146,23 @@ cJSON *world_anchor_convertToJSON(world_anchor_t *world_anchor) { + if (world_storage_api_world_anchor__NULL == world_anchor->unit) { + goto fail; + } +- cJSON *unit_local_JSON = unit_system_convertToJSON(world_anchor->unit); ++ cJSON *unit_local_JSON = unit_system_unit_system_convertToJSON(*world_anchor->unit); + if(unit_local_JSON == NULL) { + goto fail; // custom + } +- cJSON_AddItemToObject(item, "unit", unit_local_JSON); ++ char *unit_str = cJSON_GetStringValue(unit_local_JSON); ++ if (unit_str == NULL) { ++ goto fail; ++ } ++ if (cJSON_AddStringToObject(item, "unit", unit_str) == NULL) { ++ goto fail; ++ } + if(item->child == NULL) { + goto fail; + } + + ++ + // world_anchor->world_anchor_size + if (!world_anchor->world_anchor_size) { + goto fail; +@@ -173,22 +180,24 @@ cJSON *world_anchor_convertToJSON(world_anchor_t *world_anchor) { + } + } + +- + // world_anchor->keyvalue_tags +- if (!world_anchor->keyvalue_tags) { ++ /* if (!world_anchor->keyvalue_tags) { + goto fail; + } + cJSON *keyvalue_tags = cJSON_AddObjectToObject(item, "keyvalueTags"); +- if(keyvalue_tags == NULL) { +- goto fail; //primitive map container ++ if (keyvalue_tags == NULL) { ++ goto fail; // primitive map container + } +- cJSON *localMapObject = keyvalue_tags; + listEntry_t *keyvalue_tagsListEntry; +- if (world_anchor->keyvalue_tags) { + list_ForEach(keyvalue_tagsListEntry, world_anchor->keyvalue_tags) { + keyValuePair_t *localKeyValue = (keyValuePair_t*)keyvalue_tagsListEntry->data; +- } +- } ++ if (localKeyValue == NULL || localKeyValue->key == NULL || localKeyValue->value == NULL) { ++ goto fail; ++ } ++ //if (cJSON_AddStringToObject(keyvalue_tags, localKeyValue->key, (char *)localKeyValue->value) == NULL) { ++ // goto fail; // add key-value pair ++ //} ++ }*/ + + return item; + fail: +@@ -276,13 +285,14 @@ world_anchor_t *world_anchor_parseFromJSON(cJSON *world_anchorJSON){ + } + + // world_anchor->unit ++ unit_local_nonprim = (unit_system_t *)malloc(sizeof(unit_system_t)); + cJSON *unit = cJSON_GetObjectItemCaseSensitive(world_anchorJSON, "unit"); + if (!unit) { + goto end; + } + + +- unit_local_nonprim = unit_system_parseFromJSON(unit); //custom ++ *unit_local_nonprim = unit_system_unit_system_parseFromJSON(unit); //custom + + // world_anchor->world_anchor_size + cJSON *world_anchor_size = cJSON_GetObjectItemCaseSensitive(world_anchorJSON, "worldAnchorSize"); +@@ -313,7 +323,7 @@ world_anchor_t *world_anchor_parseFromJSON(cJSON *world_anchorJSON){ + } + + // world_anchor->keyvalue_tags +- cJSON *keyvalue_tags = cJSON_GetObjectItemCaseSensitive(world_anchorJSON, "keyvalueTags"); ++ /* cJSON *keyvalue_tags = cJSON_GetObjectItemCaseSensitive(world_anchorJSON, "keyvalueTags"); + if (!keyvalue_tags) { + goto end; + } +@@ -334,8 +344,7 @@ world_anchor_t *world_anchor_parseFromJSON(cJSON *world_anchorJSON){ + list_addElement(keyvalue_tagsList , localMapKeyPair); + } + } +- +- ++*/ + world_anchor_local_var = world_anchor_create ( + uuid && !cJSON_IsNull(uuid) ? strdup(uuid->valuestring) : NULL, + strdup(name->valuestring), +@@ -343,7 +352,7 @@ world_anchor_t *world_anchor_parseFromJSON(cJSON *world_anchorJSON){ + local_crsList, + unit_local_nonprim, + world_anchor_sizeList, +- keyvalue_tagsList ++ NULL// keyvalue_tagsList + ); + + return world_anchor_local_var; diff --git a/EtsiClientGen/patches/fixCWorldAnchorAPI.patch b/EtsiClientGen/patches/fixCWorldAnchorAPI.patch index 3fbebe6fa98b266580383f5240d03ff555559fec..36a3f2bd2f5e0589f2e28bc60ce225f2a61174e2 100644 --- a/EtsiClientGen/patches/fixCWorldAnchorAPI.patch +++ b/EtsiClientGen/patches/fixCWorldAnchorAPI.patch @@ -1,6 +1,49 @@ ---- WorldAnchorsAPI_origin.c 2024-05-17 23:28:13.635759091 +0200 -+++ WorldAnchorsAPI.c 2024-05-17 23:28:43.856060784 +0200 -@@ -151,16 +151,7 @@ +diff --git a/EtsiClientGen/api/WorldAnchorsAPI.c b/../../world-storage-c-client/EtsiClientGen/api/WorldAnchorsAPI.c +index 9fd9ef4..7088395 100644 +--- a/EtsiClientGen/api/WorldAnchorsAPI.c ++++ b/../../world-storage-c-client/EtsiClientGen/api/WorldAnchorsAPI.c +@@ -68,25 +68,25 @@ WorldAnchorsAPI_addWorldAnchor(apiClient_t *apiClient, world_anchor_t *world_anc + "POST"); + + // uncomment below to debug the error response +- //if (apiClient->response_code == 200) { +- // printf("%s\n","OK, return the UUID of the World Anchor defined by the world storage."); +- //} ++ if (apiClient->response_code == 200) { ++ // printf("%s\n","OK, return the UUID of the World Anchor defined by the world storage."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 201) { +- // printf("%s\n","Null response."); +- //} ++ if (apiClient->response_code == 201) { ++ printf("%s\n","Null response."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 400) { +- // printf("%s\n","Bad request."); +- //} ++ if (apiClient->response_code == 400) { ++ printf("%s\n","Bad request."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 409) { +- // printf("%s\n","Invalid UUID, id must be a Nil value."); +- //} ++ if (apiClient->response_code == 409) { ++ printf("%s\n","Invalid UUID, id must be a Nil value."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 0) { +- // printf("%s\n","Unexpected error."); +- //} ++ if (apiClient->response_code == 0) { ++ printf("%s\n","Unexpected error."); ++ } + //primitive return type simple + char* elementToReturn = strdup((char*)apiClient->dataReceived); + +@@ -151,16 +151,7 @@ WorldAnchorsAPI_deleteWorldAnchor(apiClient_t *apiClient, char *worldAnchorUUID, sprintf(localVarToReplace_worldAnchorUUID, "{%s}", "worldAnchorUUID"); localVarPath = strReplace(localVarPath, localVarToReplace_worldAnchorUUID, worldAnchorUUID); @@ -18,7 +61,7 @@ // header parameters char *keyHeader_token = NULL; char * valueHeader_token = 0; -@@ -255,16 +246,7 @@ +@@ -255,16 +246,7 @@ WorldAnchorsAPI_getWorldAnchorById(apiClient_t *apiClient, char *worldAnchorUUID sprintf(localVarToReplace_worldAnchorUUID, "{%s}", "worldAnchorUUID"); localVarPath = strReplace(localVarPath, localVarToReplace_worldAnchorUUID, worldAnchorUUID); diff --git a/EtsiClientGen/patches/fixCWorldLink.patch b/EtsiClientGen/patches/fixCWorldLink.patch index a9b6a9be9e9019e49dffdd44f6030d24aca79e20..9bc720391718c14dceea18014ccbf81dade8ab36 100644 --- a/EtsiClientGen/patches/fixCWorldLink.patch +++ b/EtsiClientGen/patches/fixCWorldLink.patch @@ -1,5 +1,7 @@ ---- world_link_origin.c 2024-05-17 23:43:30.883486119 +0200 -+++ world_link.c 2024-05-17 23:43:53.193634445 +0200 +diff --git a/EtsiClientGen/model/world_link.c b/../../world-storage-c-client/EtsiClientGen/model/world_link.c +index 82f9653..102a149 100644 +--- a/EtsiClientGen/model/world_link.c ++++ b/../../world-storage-c-client/EtsiClientGen/model/world_link.c @@ -4,58 +4,6 @@ #include "world_link.h" @@ -59,16 +61,78 @@ world_link_t *world_link_create( char *uuid, char *creator_uuid, -@@ -177,7 +125,7 @@ +@@ -122,7 +70,7 @@ void world_link_free(world_link_t *world_link) { + world_link->transform = NULL; + } + if (world_link->unit) { +- unit_system_free(world_link->unit); ++ free(world_link->unit); + world_link->unit = NULL; + } + if (world_link->keyvalue_tags) { +@@ -147,7 +95,7 @@ cJSON *world_link_convertToJSON(world_link_t *world_link) { + goto fail; //String + } + } +- ++ + + // world_link->creator_uuid + if (!world_link->creator_uuid) { +@@ -157,6 +105,7 @@ cJSON *world_link_convertToJSON(world_link_t *world_link) { + goto fail; //String + } + ++ + + // world_link->uuid_from + if (!world_link->uuid_from) { +@@ -166,6 +115,7 @@ cJSON *world_link_convertToJSON(world_link_t *world_link) { + goto fail; //String + } + ++ + + // world_link->uuidto + if (!world_link->uuidto) { +@@ -174,35 +124,59 @@ cJSON *world_link_convertToJSON(world_link_t *world_link) { + if(cJSON_AddStringToObject(item, "UUIDTo", world_link->uuidto) == NULL) { + goto fail; //String + } ++ // world_link->type_from - if (world_storage_api_world_link__NULL == world_link->type_from) { + if (world_storage_api_type_world_storage__NULL == world_link->type_from) { ++ goto fail; } - cJSON *type_from_local_JSON = type_world_storage_convertToJSON(world_link->type_from); -@@ -191,7 +139,7 @@ +- cJSON *type_from_local_JSON = type_world_storage_convertToJSON(world_link->type_from); ++ cJSON *type_from_local_JSON = type_world_storage_type_world_storage_convertToJSON(*world_link->type_from); ++ ++ + if(type_from_local_JSON == NULL) { ++ + goto fail; // custom + } +- cJSON_AddItemToObject(item, "typeFrom", type_from_local_JSON); ++ char *type_from_str = cJSON_GetStringValue(type_from_local_JSON); ++ ++ if (type_from_str == NULL) { ++ ++ goto fail; ++ } ++ ++ if (cJSON_AddStringToObject(item, "typeFrom", type_from_str) == NULL) { ++ ++ goto fail; ++ } + if(item->child == NULL) { ++ + goto fail; + } ++ // world_link->type_to @@ -76,13 +140,154 @@ + if (world_storage_api_type_world_storage__NULL == world_link->type_to) { goto fail; } - cJSON *type_to_local_JSON = type_world_storage_convertToJSON(world_link->type_to); -@@ -223,7 +171,7 @@ +- cJSON *type_to_local_JSON = type_world_storage_convertToJSON(world_link->type_to); ++ cJSON *type_to_local_JSON = type_world_storage_type_world_storage_convertToJSON(*world_link->type_to); + if(type_to_local_JSON == NULL) { + goto fail; // custom + } +- cJSON_AddItemToObject(item, "typeTo", type_to_local_JSON); ++ char *type_to_str = cJSON_GetStringValue(type_to_local_JSON); ++ if (type_to_str == NULL) { ++ goto fail; ++ } ++ if (cJSON_AddStringToObject(item, "typeTo", type_to_str) == NULL) { ++ goto fail; ++ } + if(item->child == NULL) { + goto fail; + } + ++ + + // world_link->transform + if (!world_link->transform) { +@@ -221,21 +195,28 @@ cJSON *world_link_convertToJSON(world_link_t *world_link) { + } + } ++ // world_link->unit - if (world_storage_api_world_link__NULL == world_link->unit) { + if (world_storage_api_unit_system__NULL == world_link->unit) { goto fail; } - cJSON *unit_local_JSON = unit_system_convertToJSON(world_link->unit); +- cJSON *unit_local_JSON = unit_system_convertToJSON(world_link->unit); ++ cJSON *unit_local_JSON = unit_system_unit_system_convertToJSON(*world_link->unit); + if(unit_local_JSON == NULL) { + goto fail; // custom + } +- cJSON_AddItemToObject(item, "unit", unit_local_JSON); ++ char *unit_str = cJSON_GetStringValue(unit_local_JSON); ++ if (unit_str == NULL) { ++ goto fail; ++ } ++ if (cJSON_AddStringToObject(item, "unit", unit_str) == NULL) { ++ goto fail; ++ } + if(item->child == NULL) { + goto fail; + } +- +- ++ ++/* + // world_link->keyvalue_tags + if (!world_link->keyvalue_tags) { + goto fail; +@@ -250,7 +231,7 @@ cJSON *world_link_convertToJSON(world_link_t *world_link) { + list_ForEach(keyvalue_tagsListEntry, world_link->keyvalue_tags) { + keyValuePair_t *localKeyValue = (keyValuePair_t*)keyvalue_tagsListEntry->data; + } +- } ++ }*/ + + return item; + fail: +@@ -325,22 +306,24 @@ world_link_t *world_link_parseFromJSON(cJSON *world_linkJSON){ + } + + // world_link->type_from ++ type_from_local_nonprim = (type_world_storage_t *)malloc(sizeof(type_world_storage_t)); + cJSON *type_from = cJSON_GetObjectItemCaseSensitive(world_linkJSON, "typeFrom"); + if (!type_from) { + goto end; + } + + +- type_from_local_nonprim = type_world_storage_parseFromJSON(type_from); //custom ++ *type_from_local_nonprim = type_world_storage_type_world_storage_parseFromJSON(type_from); //custom + + // world_link->type_to ++ type_to_local_nonprim = (type_world_storage_t *)malloc(sizeof(type_world_storage_t)); + cJSON *type_to = cJSON_GetObjectItemCaseSensitive(world_linkJSON, "typeTo"); + if (!type_to) { + goto end; + } + + +- type_to_local_nonprim = type_world_storage_parseFromJSON(type_to); //custom ++ *type_to_local_nonprim = type_world_storage_type_world_storage_parseFromJSON(type_to); //custom + + // world_link->transform + cJSON *transform = cJSON_GetObjectItemCaseSensitive(world_linkJSON, "transform"); +@@ -371,16 +354,17 @@ world_link_t *world_link_parseFromJSON(cJSON *world_linkJSON){ + } + + // world_link->unit ++ unit_local_nonprim = (unit_system_t *)malloc(sizeof(unit_system_t)); + cJSON *unit = cJSON_GetObjectItemCaseSensitive(world_linkJSON, "unit"); + if (!unit) { + goto end; + } + + +- unit_local_nonprim = unit_system_parseFromJSON(unit); //custom +- ++ *unit_local_nonprim = unit_system_unit_system_parseFromJSON(unit); //custom ++ + // world_link->keyvalue_tags +- cJSON *keyvalue_tags = cJSON_GetObjectItemCaseSensitive(world_linkJSON, "keyvalueTags"); ++ /* cJSON *keyvalue_tags = cJSON_GetObjectItemCaseSensitive(world_linkJSON, "keyvalueTags"); + if (!keyvalue_tags) { + goto end; + } +@@ -402,7 +386,7 @@ world_link_t *world_link_parseFromJSON(cJSON *world_linkJSON){ + } + } + +- ++*/ + world_link_local_var = world_link_create ( + uuid && !cJSON_IsNull(uuid) ? strdup(uuid->valuestring) : NULL, + strdup(creator_uuid->valuestring), +@@ -412,17 +396,17 @@ world_link_t *world_link_parseFromJSON(cJSON *world_linkJSON){ + type_to_local_nonprim, + transformList, + unit_local_nonprim, +- keyvalue_tagsList ++ NULL// keyvalue_tagsList + ); + + return world_link_local_var; + end: + if (type_from_local_nonprim) { +- type_world_storage_free(type_from_local_nonprim); ++ free(type_from_local_nonprim); + type_from_local_nonprim = NULL; + } + if (type_to_local_nonprim) { +- type_world_storage_free(type_to_local_nonprim); ++ free(type_to_local_nonprim); + type_to_local_nonprim = NULL; + } + if (transformList) { +@@ -435,7 +419,7 @@ end: + transformList = NULL; + } + if (unit_local_nonprim) { +- unit_system_free(unit_local_nonprim); ++ free(unit_local_nonprim); + unit_local_nonprim = NULL; + } + if (keyvalue_tagsList) { diff --git a/EtsiClientGen/patches/fixCWorldLinkAPI.patch b/EtsiClientGen/patches/fixCWorldLinkAPI.patch index f030069add8ab6b885f80828e3c8d25b635cfdcb..2ef39b588205e0b07b2a65b2bd6231314e403853 100644 --- a/EtsiClientGen/patches/fixCWorldLinkAPI.patch +++ b/EtsiClientGen/patches/fixCWorldLinkAPI.patch @@ -1,6 +1,48 @@ ---- WorldLinksAPI_origin.c 2024-05-17 23:28:29.575918299 +0200 -+++ WorldLinksAPI.c 2024-05-17 23:28:56.976190462 +0200 -@@ -151,16 +151,7 @@ +diff --git a/EtsiClientGen/api/WorldLinksAPI.c b/../../world-storage-c-client/EtsiClientGen/api/WorldLinksAPI.c +index a6499cd..950bc0e 100644 +--- a/EtsiClientGen/api/WorldLinksAPI.c ++++ b/../../world-storage-c-client/EtsiClientGen/api/WorldLinksAPI.c +@@ -68,25 +68,25 @@ WorldLinksAPI_addWorldLink(apiClient_t *apiClient, world_link_t *world_link, cha + "POST"); + + // uncomment below to debug the error response +- //if (apiClient->response_code == 200) { ++ if (apiClient->response_code == 200) { + // printf("%s\n","OK, return the UUID of the World Link defined by the world storage."); +- //} ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 201) { +- // printf("%s\n","Null response."); +- //} ++ if (apiClient->response_code == 201) { ++ printf("%s\n","Null response."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 400) { +- // printf("%s\n","Bad request."); +- //} ++ if (apiClient->response_code == 400) { ++ printf("%s\n","Bad request."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 409) { +- // printf("%s\n","Invalid UUID, id must be a Nil value."); +- //} ++ if (apiClient->response_code == 409) { ++ printf("%s\n","Invalid UUID, id must be a Nil value."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 0) { +- // printf("%s\n","Unexpected error."); +- //} ++ if (apiClient->response_code == 0) { ++ printf("%s\n","Unexpected error."); ++ } + //primitive return type simple + char* elementToReturn = strdup((char*)apiClient->dataReceived); + +@@ -151,16 +151,7 @@ WorldLinksAPI_deleteWorldLink(apiClient_t *apiClient, char *worldLinkUUID, char sprintf(localVarToReplace_worldLinkUUID, "{%s}", "worldLinkUUID"); localVarPath = strReplace(localVarPath, localVarToReplace_worldLinkUUID, worldLinkUUID); @@ -18,7 +60,7 @@ // header parameters char *keyHeader_token = NULL; char * valueHeader_token = 0; -@@ -255,16 +246,7 @@ +@@ -255,16 +246,7 @@ WorldLinksAPI_getWorldLinkById(apiClient_t *apiClient, char *worldLinkUUID, char sprintf(localVarToReplace_worldLinkUUID, "{%s}", "worldLinkUUID"); localVarPath = strReplace(localVarPath, localVarToReplace_worldLinkUUID, worldLinkUUID); diff --git a/EtsiClientGen/patches/fixHeaderTrackable.patch b/EtsiClientGen/patches/fixHeaderTrackable.patch index 83a854a19e3d84b484bc26bc0081d79a349cea01..047cdd7d0e5748c48bc6b75c0a469246014a26f4 100644 --- a/EtsiClientGen/patches/fixHeaderTrackable.patch +++ b/EtsiClientGen/patches/fixHeaderTrackable.patch @@ -1,6 +1,8 @@ ---- trackable_origin.h 2024-05-17 23:05:41.556322567 +0200 -+++ trackable.h 2024-05-17 23:06:00.866712577 +0200 -@@ -19,24 +19,6 @@ +diff --git a/EtsiClientGen/model/trackable.h b/../../world-storage-c-client/EtsiClientGen/model/trackable.h +index 5137853..5c4ff83 100644 +--- a/EtsiClientGen/model/trackable.h ++++ b/../../world-storage-c-client/EtsiClientGen/model/trackable.h +@@ -19,24 +19,6 @@ typedef struct trackable_t trackable_t; #include "trackable_type.h" #include "unit_system.h" diff --git a/EtsiClientGen/patches/fixHeaderTrackableType.patch b/EtsiClientGen/patches/fixHeaderTrackableType.patch index ffd62149fe1b1d2a52b63323f73b629ad0d846fd..9210e198c2f767739c7ef74e2b92da3e868fc0e2 100644 --- a/EtsiClientGen/patches/fixHeaderTrackableType.patch +++ b/EtsiClientGen/patches/fixHeaderTrackableType.patch @@ -1,5 +1,7 @@ ---- trackable_type_origin.h 2024-05-28 14:41:34.877357153 +0200 -+++ trackable_type.h 2024-05-22 17:57:49.859596000 +0200 +diff --git a/EtsiClientGen/model/trackable_type.h b/../../world-storage-c-client/EtsiClientGen/model/trackable_type.h +index 6a4114c..9798a33 100644 +--- a/EtsiClientGen/model/trackable_type.h ++++ b/../../world-storage-c-client/EtsiClientGen/model/trackable_type.h @@ -13,20 +13,20 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" diff --git a/EtsiClientGen/patches/fixHeaderTypeWorldStorage.patch b/EtsiClientGen/patches/fixHeaderTypeWorldStorage.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6e98b8a59adc36444833aba589633dc5cc63703 --- /dev/null +++ b/EtsiClientGen/patches/fixHeaderTypeWorldStorage.patch @@ -0,0 +1,28 @@ +diff --git a/EtsiClientGen/model/type_world_storage.h b/../../world-storage-c-client/EtsiClientGen/model/type_world_storage.h +index a04695b..a0a7792 100644 +--- a/EtsiClientGen/model/type_world_storage.h ++++ b/../../world-storage-c-client/EtsiClientGen/model/type_world_storage.h +@@ -13,20 +13,20 @@ + #include "../include/keyValuePair.h" + #include "../include/binary.h" + +-typedef struct type_world_storage_t type_world_storage_t; + + + // Enum for type_world_storage + + typedef enum { world_storage_api_type_world_storage__NULL = 0, world_storage_api_type_world_storage__TRACKABLE, world_storage_api_type_world_storage__ANCHOR, world_storage_api_type_world_storage__UNKNOWN } world_storage_api_type_world_storage__e; ++typedef world_storage_api_type_world_storage__e type_world_storage_t; + + char* type_world_storage_type_world_storage_ToString(world_storage_api_type_world_storage__e type_world_storage); + + world_storage_api_type_world_storage__e type_world_storage_type_world_storage_FromString(char* type_world_storage); + +-//cJSON *type_world_storage_type_world_storage_convertToJSON(world_storage_api_type_world_storage__e type_world_storage); ++cJSON *type_world_storage_type_world_storage_convertToJSON(world_storage_api_type_world_storage__e type_world_storage); + +-//world_storage_api_type_world_storage__e type_world_storage_type_world_storage_parseFromJSON(cJSON *type_world_storageJSON); ++world_storage_api_type_world_storage__e type_world_storage_type_world_storage_parseFromJSON(cJSON *type_world_storageJSON); + + #endif /* _type_world_storage_H_ */ + diff --git a/EtsiClientGen/patches/fixHeaderUnitSystem.patch b/EtsiClientGen/patches/fixHeaderUnitSystem.patch index 6ee54be609c4539ac79538f16febafeb82c05ba8..c509ba5d15be1c91b81c85c318eae0ff0738a18b 100644 --- a/EtsiClientGen/patches/fixHeaderUnitSystem.patch +++ b/EtsiClientGen/patches/fixHeaderUnitSystem.patch @@ -1,5 +1,7 @@ ---- unit_system_origin.h 2024-05-28 14:41:34.887357155 +0200 -+++ unit_system.h 2024-05-22 18:37:07.017974000 +0200 +diff --git a/EtsiClientGen/model/unit_system.h b/../../world-storage-c-client/EtsiClientGen/model/unit_system.h +index 9c621fa..220ff86 100644 +--- a/EtsiClientGen/model/unit_system.h ++++ b/../../world-storage-c-client/EtsiClientGen/model/unit_system.h @@ -13,20 +13,17 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" diff --git a/EtsiClientGen/patches/fixHeaderWorldLink.patch b/EtsiClientGen/patches/fixHeaderWorldLink.patch index 0465f9cb9758a93f3c15704225d2ebb258268eb0..835eec165df1371d20a4b6a0a14974a6c4e63535 100644 --- a/EtsiClientGen/patches/fixHeaderWorldLink.patch +++ b/EtsiClientGen/patches/fixHeaderWorldLink.patch @@ -1,6 +1,8 @@ ---- world_link_origin.h 2024-05-17 23:08:53.449892849 +0200 -+++ world_link.h 2024-05-17 23:13:56.354907893 +0200 -@@ -26,24 +26,6 @@ +diff --git a/EtsiClientGen/model/world_link.h b/../../world-storage-c-client/EtsiClientGen/model/world_link.h +index fba34e4..d8ccc62 100644 +--- a/EtsiClientGen/model/world_link.h ++++ b/../../world-storage-c-client/EtsiClientGen/model/world_link.h +@@ -26,24 +26,6 @@ char* world_link_type_from_ToString(world_storage_api_world_link__e type_from); world_storage_api_world_link__e world_link_type_from_FromString(char* type_from); diff --git a/EtsiClientGen/patches/fixRelocalizationInformationAPI.patch b/EtsiClientGen/patches/fixRelocalizationInformationAPI.patch new file mode 100644 index 0000000000000000000000000000000000000000..9a215cf9cb1cdbf325106601f345098cb1396b3f --- /dev/null +++ b/EtsiClientGen/patches/fixRelocalizationInformationAPI.patch @@ -0,0 +1,77 @@ +diff --git a/EtsiClientGen/api/RelocalizationInformationAPI.c b/../../world-storage-c-client/EtsiClientGen/api/RelocalizationInformationAPI.c +index 0f8b24a..0a69f2e 100644 +--- a/EtsiClientGen/api/RelocalizationInformationAPI.c ++++ b/../../world-storage-c-client/EtsiClientGen/api/RelocalizationInformationAPI.c +@@ -44,16 +44,22 @@ RelocalizationInformationAPI_getRelocalizationInformation(apiClient_t *apiClient + } + + +- // query parameters +- if (uuids) +- { +- list_addElement(localVarQueryParameters,uuids); ++ ++ // query parameters ++ listEntry_t *uuid = NULL; ++ list_ForEach(uuid, uuids) { ++ char *element = (char *)uuid->data; ++ char *key = strdup("uuids"); ++ keyValuePair_t *keyPair = keyValuePair_create(key, element); ++ list_addElement(localVarQueryParameters, keyPair); + } + +- // query parameters +- if (capabilities) +- { +- list_addElement(localVarQueryParameters,capabilities); ++ listEntry_t *cap = NULL; ++ list_ForEach(cap, capabilities) { ++ char *element = (char *)cap->data; ++ char *key = strdup("capabilities"); ++ keyValuePair_t *keyPair = keyValuePair_create(key, element); ++ list_addElement(localVarQueryParameters, keyPair); + } + list_addElement(localVarHeaderType,"application/json"); //produces + list_addElement(localVarHeaderType,"text/plain"); //produces +@@ -68,27 +74,28 @@ RelocalizationInformationAPI_getRelocalizationInformation(apiClient_t *apiClient + "GET"); + + // uncomment below to debug the error response +- //if (apiClient->response_code == 200) { +- // printf("%s\n","Successful operation."); +- //} ++ if (apiClient->response_code == 200) { ++ //printf("%s\n","Successful operation."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 400) { +- // printf("%s\n","Invalid UUID supplied."); +- //} ++ if (apiClient->response_code == 400) { ++ printf("%s\n","Invalid UUID supplied."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 404) { +- // printf("%s\n","Not found, could not find UUID in database."); +- //} ++ if (apiClient->response_code == 404) { ++ printf("%s\n","Not found, could not find UUID in database."); ++ } + // uncomment below to debug the error response +- //if (apiClient->response_code == 0) { +- // printf("%s\n","Unexpected error."); +- //} ++ if (apiClient->response_code == 0) { ++ printf("%s\n","Unexpected error."); ++ } + //nonprimitive not container + cJSON *RelocalizationInformationAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived); ++ + get_relocalization_information_200_response_t *elementToReturn = get_relocalization_information_200_response_parseFromJSON(RelocalizationInformationAPIlocalVarJSON); + cJSON_Delete(RelocalizationInformationAPIlocalVarJSON); + if(elementToReturn == NULL) { +- // return 0; ++ return 0; + } + + //return type