diff --git a/src/iec61850/client/client_control.c b/src/iec61850/client/client_control.c index 4ad2eb2c..5bbfd924 100644 --- a/src/iec61850/client/client_control.c +++ b/src/iec61850/client/client_control.c @@ -610,7 +610,7 @@ ControlObjectClient_operateAsync(ControlObjectClient self, IedClientError* err, MmsError mmsError; - call->invokeId = MmsConnection_writeVariableAsync(self->connection->connection, &mmsError, domainId, itemId, operParameters, internalOperateHandler, self); + MmsConnection_writeVariableAsync(self->connection->connection, &(call->invokeId), &mmsError, domainId, itemId, operParameters, internalOperateHandler, self); invokeId = call->invokeId; @@ -855,7 +855,7 @@ ControlObjectClient_selectWithValueAsync(ControlObjectClient self, IedClientErro if (DEBUG_IED_CLIENT) printf("IED_CLIENT: select with value: %s/%s\n", domainId, itemId); - call->invokeId = MmsConnection_writeVariableAsync(self->connection->connection, &mmsError, domainId, itemId, selValParameters, internalSelWithValHandler, self); + MmsConnection_writeVariableAsync(self->connection->connection, &(call->invokeId), &mmsError, domainId, itemId, selValParameters, internalSelWithValHandler, self); invokeId = call->invokeId; @@ -1040,8 +1040,8 @@ ControlObjectClient_selectAsync(ControlObjectClient self, IedClientError* err, C if (DEBUG_IED_CLIENT) printf("IED_CLIENT: select: %s/%s\n", domainId, itemId); - call->invokeId = MmsConnection_readVariableAsync(IedConnection_getMmsConnection(self->connection), - &mmsError, domainId, itemId, internalSelectHandler, self); + MmsConnection_readVariableAsync(IedConnection_getMmsConnection(self->connection), + &(call->invokeId), &mmsError, domainId, itemId, internalSelectHandler, self); invokeId = call->invokeId; @@ -1227,7 +1227,7 @@ ControlObjectClient_cancelAsync(ControlObjectClient self, IedClientError* err, C if (DEBUG_IED_CLIENT) printf("IED_CLIENT: select with value: %s/%s\n", domainId, itemId); - call->invokeId = MmsConnection_writeVariableAsync(self->connection->connection, &mmsError, domainId, itemId, cancelParameters, internalCancelHandler, self); + MmsConnection_writeVariableAsync(self->connection->connection, &(call->invokeId), &mmsError, domainId, itemId, cancelParameters, internalCancelHandler, self); invokeId = call->invokeId; diff --git a/src/iec61850/client/client_report_control.c b/src/iec61850/client/client_report_control.c index 12006158..6ef7c0aa 100644 --- a/src/iec61850/client/client_report_control.c +++ b/src/iec61850/client/client_report_control.c @@ -624,7 +624,7 @@ IedConnection_getRCBValuesAsync(IedConnection self, IedClientError* error, const MmsError err = MMS_ERROR_NONE; - call->invokeId = MmsConnection_readVariableAsync(self->connection, &err, domainId, itemId, readObjectHandlerInternal, self); + MmsConnection_readVariableAsync(self->connection, &(call->invokeId), &err, domainId, itemId, readObjectHandlerInternal, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -758,7 +758,7 @@ writeMultipleVariablesHandler(uint32_t invokeId, void* parameter, MmsError mmsEr } else { if (DEBUG_IED_CLIENT) - printf("IED_CLIENT: internal error - no matching outstanding call!\n"); + printf("IED_CLIENT: internal error - no matching outstanding call with invoke ID: %u!\n", invokeId); } } @@ -828,7 +828,7 @@ writeVariableHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsD MmsError writeError; - call->invokeId = MmsConnection_writeVariableAsync(self->connection, &writeError, param->domainId, itemId, value, writeVariableHandler, self); + MmsConnection_writeVariableAsync(self->connection, &(call->invokeId), &writeError, param->domainId, itemId, value, writeVariableHandler, self); if (writeError != MMS_ERROR_NONE) { handler(param->originalInvokeId, call->callbackParameter, iedConnection_mapMmsErrorToIedError(writeError)); @@ -1006,7 +1006,7 @@ IedConnection_setRCBValuesAsync(IedConnection self, IedClientError* error, Clien if (singleRequest) { - call->invokeId = MmsConnection_writeMultipleVariablesAsync(self->connection, &err, domainId, itemIds, values, writeMultipleVariablesHandler, self); + MmsConnection_writeMultipleVariablesAsync(self->connection, &(call->invokeId), &err, domainId, itemIds, values, writeMultipleVariablesHandler, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -1035,7 +1035,7 @@ IedConnection_setRCBValuesAsync(IedConnection self, IedClientError* error, Clien char* variableId = (char*) LinkedList_getData(param->currentItemId); MmsValue* value = (MmsValue*) LinkedList_getData(param->currentValue); - call->invokeId = MmsConnection_writeVariableAsync(self->connection, &err, domainId, variableId, value, writeVariableHandler, self); + MmsConnection_writeVariableAsync(self->connection, &(call->invokeId), &err, domainId, variableId, value, writeVariableHandler, self); param->originalInvokeId = call->invokeId; diff --git a/src/iec61850/client/ied_connection.c b/src/iec61850/client/ied_connection.c index e8eb0923..3dbd7c12 100644 --- a/src/iec61850/client/ied_connection.c +++ b/src/iec61850/client/ied_connection.c @@ -942,7 +942,7 @@ IedConnection_getVariableSpecificationAsync(IedConnection self, IedClientError* call->callback = handler; call->callbackParameter = parameter; - call->invokeId = MmsConnection_getVariableAccessAttributesAsync(self->connection, &err, domainId, itemId, getAccessAttrHandler, self); + MmsConnection_getVariableAccessAttributesAsync(self->connection, &(call->invokeId), &err, domainId, itemId, getAccessAttrHandler, self); invokeId = call->invokeId; @@ -991,7 +991,7 @@ IedConnection_getServerDirectoryAsync(IedConnection self, IedClientError* error, MmsError err = MMS_ERROR_NONE; - call->invokeId = MmsConnection_getDomainNamesAsync(self->connection, &err, continueAfter, result, getNameListHandler, self); + MmsConnection_getDomainNamesAsync(self->connection, &(call->invokeId), &err, continueAfter, result, getNameListHandler, self); if (err != MMS_ERROR_NONE) { *error = iedConnection_mapMmsErrorToIedError(err); @@ -1007,9 +1007,6 @@ IedConnection_getServerDirectoryAsync(IedConnection self, IedClientError* error, return call->invokeId; } - - - uint32_t IedConnection_getLogicalDeviceVariablesAsync(IedConnection self, IedClientError* error, const char* ldName, const char* continueAfter, LinkedList result, IedConnection_GetNameListHandler handler, void* parameter) @@ -1026,7 +1023,7 @@ IedConnection_getLogicalDeviceVariablesAsync(IedConnection self, IedClientError* MmsError err = MMS_ERROR_NONE; - call->invokeId = MmsConnection_getDomainVariableNamesAsync(self->connection, &err, ldName, continueAfter, result, getNameListHandler, self); + MmsConnection_getDomainVariableNamesAsync(self->connection, &err, &(call->invokeId), ldName, continueAfter, result, getNameListHandler, self); if (err != MMS_ERROR_NONE) { *error = iedConnection_mapMmsErrorToIedError(err); @@ -1058,7 +1055,7 @@ IedConnection_getLogicalDeviceDataSetsAsync(IedConnection self, IedClientError* MmsError err = MMS_ERROR_NONE; - call->invokeId = MmsConnection_getDomainVariableListNamesAsync(self->connection, &err, ldName, continueAfter, result, getNameListHandler, self); + MmsConnection_getDomainVariableListNamesAsync(self->connection, &(call->invokeId), &err, ldName, continueAfter, result, getNameListHandler, self); if (err != MMS_ERROR_NONE) { *error = iedConnection_mapMmsErrorToIedError(err); @@ -1146,7 +1143,7 @@ IedConnection_readObjectAsync(IedConnection self, IedClientError* error, const c *brace = 0; - call->invokeId = MmsConnection_readSingleArrayElementWithComponentAsync(self->connection, &err, domainId, itemId, index, component, readObjectHandlerInternal, self); + MmsConnection_readSingleArrayElementWithComponentAsync(self->connection, &(call->invokeId), &err, domainId, itemId, index, component, readObjectHandlerInternal, self); } else *error = IED_ERROR_USER_PROVIDED_INVALID_ARGUMENT; @@ -1155,7 +1152,7 @@ IedConnection_readObjectAsync(IedConnection self, IedClientError* error, const c *error = IED_ERROR_USER_PROVIDED_INVALID_ARGUMENT; } else - call->invokeId = MmsConnection_readVariableAsync(self->connection, &err, domainId, itemId, readObjectHandlerInternal, self); + MmsConnection_readVariableAsync(self->connection, &(call->invokeId), &err, domainId, itemId, readObjectHandlerInternal, self); if ((err != MMS_ERROR_NONE) || (*error != IED_ERROR_OK)) { @@ -1559,7 +1556,7 @@ IedConnection_writeObjectAsync(IedConnection self, IedClientError* error, const *brace = 0; - call->invokeId = MmsConnection_writeSingleArrayElementWithComponentAsync(self->connection, &err, domainId, itemId, index, component, value, + MmsConnection_writeSingleArrayElementWithComponentAsync(self->connection, &(call->invokeId), &err, domainId, itemId, index, component, value, writeVariableHandler, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -1571,7 +1568,7 @@ IedConnection_writeObjectAsync(IedConnection self, IedClientError* error, const *error = IED_ERROR_USER_PROVIDED_INVALID_ARGUMENT; } else { - call->invokeId = MmsConnection_writeVariableAsync(self->connection, &err, domainId, itemId, value, writeVariableHandler, self); + MmsConnection_writeVariableAsync(self->connection, &(call->invokeId), &err, domainId, itemId, value, writeVariableHandler, self); *error = iedConnection_mapMmsErrorToIedError(err); } @@ -1885,7 +1882,7 @@ IedConnection_getFileDirectoryAsyncEx(IedConnection self, IedClientError* error, call->callbackParameter = parameter; call->specificParameter2.getFileDirectory.cont = true; - call->invokeId = MmsConnection_getFileDirectoryAsync(self->connection, &err, directoryName, continueAfter, + MmsConnection_getFileDirectoryAsync(self->connection, &(call->invokeId), &err, directoryName, continueAfter, fileDirectoryHandlerEx, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -2009,7 +2006,7 @@ mmsConnectionFileReadHandler (uint32_t invokeId, void* parameter, MmsError mmsEr if (mmsError != MMS_ERROR_SERVICE_TIMEOUT) { /* close file */ - call->invokeId = MmsConnection_fileCloseAsync(self->connection, &mmsError, frsmId, mmsConnectionFileCloseHandler, self); + MmsConnection_fileCloseAsync(self->connection, &(call->invokeId), &mmsError, frsmId, mmsConnectionFileCloseHandler, self); if (mmsError != MMS_ERROR_NONE) iedConnection_releaseOutstandingCall(self, call); @@ -2026,7 +2023,7 @@ mmsConnectionFileReadHandler (uint32_t invokeId, void* parameter, MmsError mmsEr if ((moreFollows == false) || (cont == false)) { /* close file */ - call->invokeId = MmsConnection_fileCloseAsync(self->connection, &mmsError, frsmId, mmsConnectionFileCloseHandler, self); + MmsConnection_fileCloseAsync(self->connection, &(call->invokeId), &mmsError, frsmId, mmsConnectionFileCloseHandler, self); if (mmsError != MMS_ERROR_NONE) iedConnection_releaseOutstandingCall(self, call); @@ -2034,7 +2031,7 @@ mmsConnectionFileReadHandler (uint32_t invokeId, void* parameter, MmsError mmsEr else { /* send next read request */ - call->invokeId = MmsConnection_fileReadAsync(self->connection, &mmsError, frsmId, + MmsConnection_fileReadAsync(self->connection, &(call->invokeId), &mmsError, frsmId, mmsConnectionFileReadHandler, self); if (mmsError != MMS_ERROR_NONE) { @@ -2043,7 +2040,7 @@ mmsConnectionFileReadHandler (uint32_t invokeId, void* parameter, MmsError mmsEr handler(invokeId, call->callbackParameter, err, invokeId, NULL, 0, false); /* close file */ - call->invokeId = MmsConnection_fileCloseAsync(self->connection, &mmsError, frsmId, mmsConnectionFileCloseHandler, self); + MmsConnection_fileCloseAsync(self->connection, &(call->invokeId), &mmsError, frsmId, mmsConnectionFileCloseHandler, self); if (mmsError != MMS_ERROR_NONE) { iedConnection_releaseOutstandingCall(self, call); @@ -2085,7 +2082,7 @@ mmsConnectionFileOpenHandler (uint32_t invokeId, void* parameter, MmsError mmsEr } else { call->specificParameter2.getFileInfo.originalInvokeId = invokeId; - call->invokeId = MmsConnection_fileReadAsync(self->connection, &mmsError, frsmId, mmsConnectionFileReadHandler, self); + MmsConnection_fileReadAsync(self->connection, &(call->invokeId), &mmsError, frsmId, mmsConnectionFileReadHandler, self); if (mmsError != MMS_ERROR_NONE) { IedClientError err = iedConnection_mapMmsErrorToIedError(mmsError); @@ -2093,7 +2090,7 @@ mmsConnectionFileOpenHandler (uint32_t invokeId, void* parameter, MmsError mmsEr handler(invokeId, call->callbackParameter, err, invokeId, NULL, 0, false); /* close file */ - call->invokeId = MmsConnection_fileCloseAsync(self->connection, &mmsError, frsmId, mmsConnectionFileCloseHandler, self); + MmsConnection_fileCloseAsync(self->connection, &(call->invokeId), &mmsError, frsmId, mmsConnectionFileCloseHandler, self); if (mmsError != MMS_ERROR_NONE) iedConnection_releaseOutstandingCall(self, call); @@ -2124,7 +2121,7 @@ IedConnection_getFileAsync(IedConnection self, IedClientError* error, const char call->callback = handler; call->callbackParameter = parameter; - call->invokeId = MmsConnection_fileOpenAsync(self->connection, &err, fileName, 0, mmsConnectionFileOpenHandler, self); + MmsConnection_fileOpenAsync(self->connection, &(call->invokeId), &err, fileName, 0, mmsConnectionFileOpenHandler, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -2199,7 +2196,7 @@ IedConnection_setFileAsync(IedConnection self, IedClientError* error, const char call->callback = handler; call->callbackParameter = parameter; - call->invokeId = MmsConnection_obtainFileAsync(self->connection, &err, sourceFilename, destinationFilename, deleteFileAndSetFileHandler, self); + MmsConnection_obtainFileAsync(self->connection, &(call->invokeId), &err, sourceFilename, destinationFilename, deleteFileAndSetFileHandler, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -2239,7 +2236,7 @@ IedConnection_deleteFileAsync(IedConnection self, IedClientError* error, const c call->callback = handler; call->callbackParameter = parameter; - call->invokeId = MmsConnection_fileDeleteAsync(self->connection, &err, fileName, deleteFileAndSetFileHandler, self); + MmsConnection_fileDeleteAsync(self->connection, &(call->invokeId), &err, fileName, deleteFileAndSetFileHandler, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -3410,10 +3407,10 @@ IedConnection_readDataSetValuesAsync(IedConnection self, IedClientError* error, MmsError err = MMS_ERROR_NONE; if (isAssociationSpecific) - call->invokeId = MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(self->connection, + MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(self->connection, &(call->invokeId), &err, itemId, true, getDataSetHandlerInternal, self); else - call->invokeId = MmsConnection_readNamedVariableListValuesAsync(self->connection, &err, + MmsConnection_readNamedVariableListValuesAsync(self->connection, &(call->invokeId), &err, domainId, itemId, true, getDataSetHandlerInternal, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -3569,7 +3566,7 @@ IedConnection_writeDataSetValuesAsync(IedConnection self, IedClientError* error, MmsError err = MMS_ERROR_NONE; - call->invokeId = MmsConnection_writeNamedVariableListAsync(self->connection, &err, isAssociationSpecific, domainId, itemId, values, writeDataSetHandlerInternal, self); + MmsConnection_writeNamedVariableListAsync(self->connection, &(call->invokeId), &err, isAssociationSpecific, domainId, itemId, values, writeDataSetHandlerInternal, self); *error = iedConnection_mapMmsErrorToIedError(err); @@ -3681,7 +3678,7 @@ IedConnection_queryLogByTimeAsync(IedConnection self, IedClientError* error, con MmsValue* endTimeMms = MmsValue_newBinaryTime(false); MmsValue_setBinaryTime(endTimeMms, endTime); - call->invokeId = MmsConnection_readJournalTimeRangeAsync(self->connection, &err, logDomain, logName, + MmsConnection_readJournalTimeRangeAsync(self->connection, &(call->invokeId), &err, logDomain, logName, startTimeMms, endTimeMms, readJournalHandler, self); MmsValue_delete(startTimeMms); @@ -3734,7 +3731,7 @@ IedConnection_queryLogAfterAsync(IedConnection self, IedClientError* error, cons MmsValue* timeStampMms = MmsValue_newBinaryTime(false); MmsValue_setBinaryTime(timeStampMms, timeStamp); - call->invokeId = MmsConnection_readJournalStartAfterAsync(self->connection, &err, logDomain, logName, + MmsConnection_readJournalStartAfterAsync(self->connection, &(call->invokeId), &err, logDomain, logName, timeStampMms, entryID, readJournalHandler, self); MmsValue_delete(timeStampMms); diff --git a/src/mms/inc/mms_client_connection.h b/src/mms/inc/mms_client_connection.h index fd6092f5..0ae05f2d 100644 --- a/src/mms/inc/mms_client_connection.h +++ b/src/mms/inc/mms_client_connection.h @@ -352,8 +352,8 @@ typedef void LIB61850_API LinkedList /* */ MmsConnection_getVMDVariableNames(MmsConnection self, MmsError* mmsError); -LIB61850_API uint32_t -MmsConnection_getVMDVariableNamesAsync(MmsConnection self, MmsError* mmsError, const char* continueAfter, +LIB61850_API void +MmsConnection_getVMDVariableNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* continueAfter, MmsConnection_GetNameListHandler handler, void* parameter); /** @@ -374,16 +374,15 @@ MmsConnection_getDomainNames(MmsConnection self, MmsError* mmsError); * \brief Get the domain names of the server (asynchronous version). * * \param[in] self MmsConnection instance to operate on + * \param[out] usedInvokeId the invoke ID of the request * \param[out] mmsError user provided variable to store error code * \param[in] continueAfter the name of the last received element when the call is a continuation, or NULL for the first call * \param[in] result list to store (append) the response names, or NULL to create a new list for the response names * \param[in] handler will be called when response is received or timed out. * \param[in] parameter - * - * \return the invoke ID of the request */ -LIB61850_API uint32_t -MmsConnection_getDomainNamesAsync(MmsConnection self, MmsError* mmsError, const char* continueAfter, LinkedList result, +LIB61850_API void +MmsConnection_getDomainNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* continueAfter, LinkedList result, MmsConnection_GetNameListHandler handler, void* parameter); /** @@ -406,17 +405,16 @@ MmsConnection_getDomainVariableNames(MmsConnection self, MmsError* mmsError, con * This will result in a domain specific GetNameList request. * * \param[in] self MmsConnection instance to operate on + * \param[out] usedInvokeId the invoke ID of the request * \param[out] mmsError user provided variable to store error code * \param[in] domainId the domain name for the domain specific request * \param[in] continueAfter the name of the last received element when the call is a continuation, or NULL for the first call * \param[in] result list to store (append) the response names, or NULL to create a new list for the response names * \param[in] handler will be called when response is received or timed out. * \param[in] parameter - * - * \return the invoke ID of the request */ -LIB61850_API uint32_t -MmsConnection_getDomainVariableNamesAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +LIB61850_API void +MmsConnection_getDomainVariableNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* continueAfter, LinkedList result, MmsConnection_GetNameListHandler handler, void* parameter); /** @@ -433,8 +431,8 @@ MmsConnection_getDomainVariableNamesAsync(MmsConnection self, MmsError* mmsError LIB61850_API LinkedList /* */ MmsConnection_getDomainVariableListNames(MmsConnection self, MmsError* mmsError, const char* domainId); -LIB61850_API uint32_t -MmsConnection_getDomainVariableListNamesAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +LIB61850_API void +MmsConnection_getDomainVariableListNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* continueAfter, LinkedList result, MmsConnection_GetNameListHandler handler, void* parameter); /** @@ -451,8 +449,8 @@ MmsConnection_getDomainVariableListNamesAsync(MmsConnection self, MmsError* mmsE LIB61850_API LinkedList /* */ MmsConnection_getDomainJournals(MmsConnection self, MmsError* mmsError, const char* domainId); -LIB61850_API uint32_t -MmsConnection_getDomainJournalsAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +LIB61850_API void +MmsConnection_getDomainJournalsAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* continueAfter, MmsConnection_GetNameListHandler handler, void* parameter); /** @@ -468,8 +466,8 @@ MmsConnection_getDomainJournalsAsync(MmsConnection self, MmsError* mmsError, con LIB61850_API LinkedList /* */ MmsConnection_getVariableListNamesAssociationSpecific(MmsConnection self, MmsError* mmsError); -LIB61850_API uint32_t -MmsConnection_getVariableListNamesAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_getVariableListNamesAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* continueAfter, MmsConnection_GetNameListHandler handler, void* parameter); @@ -495,15 +493,14 @@ typedef void /** * \brief Read a single variable from the server (asynchronous version) * - * \param self MmsConnection instance to operate on - * \param mmsError user provided variable to store error code - * \param domainId the domain name of the variable to be read or NULL to read a VMD specific named variable - * \param itemId name of the variable to be read - * - * \return invoke ID of the request when the request was sent successfully + * \param{in] self MmsConnection instance to operate on + * \param[out] usedInvokeId the invoke ID of the request + * \param[out] mmsError user provided variable to store error code + * \param[in] domainId the domain name of the variable to be read or NULL to read a VMD specific named variable + * \param[in] itemId name of the variable to be read */ -LIB61850_API uint32_t -MmsConnection_readVariableAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +LIB61850_API void +MmsConnection_readVariableAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsConnection_ReadVariableHandler handler, void* parameter); /** @@ -526,18 +523,17 @@ MmsConnection_readVariableComponent(MmsConnection self, MmsError* mmsError, /** * \brief Read a component of a single variable from the server (asynchronous version) * - * \param self MmsConnection instance to operate on - * \param mmsError user provided variable to store error code - * \param domainId the domain name of the variable to be read or NULL to read a VMD specific named variable - * \param itemId name of the variable to be read - * \param componentId the component name - * \param handler - * \param parameter - * - * \return invoke ID of the request when the request was sent successfully + * \param[in] self MmsConnection instance to operate on + * \param[out] usedInvokeId the invoke ID of the request + * \param[out] mmsError user provided variable to store error code + * \param[in] domainId the domain name of the variable to be read or NULL to read a VMD specific named variable + * \param[in] itemId name of the variable to be read + * \param[in] componentId the component name + * \param[in] handler + * \param[in] parameter */ -LIB61850_API uint32_t -MmsConnection_readVariableComponentAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_readVariableComponentAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, const char* componentId, MmsConnection_ReadVariableHandler handler, void* parameter); @@ -565,17 +561,16 @@ MmsConnection_readArrayElements(MmsConnection self, MmsError* mmsError, const ch * NOTE: The MmsValue object received by the callback function is either a simple or complex type if numberOfElements is 0, or an array * containing the selected array elements of numberOfElements > 0. * - * \param self MmsConnection instance to operate on - * \param mmsError user provided variable to store error code - * \param domainId the domain name of the variable to be read - * \param itemId name of the variable to be read - * \param startIndex index of element to read or start index if a element range is to be read - * \param numberOfElements Number of elements to read or 0 if a single element is to be read - * - * \return invoke ID of the request when the request was sent successfully + * \param[in] self MmsConnection instance to operate on + * \param[out] usedInvokeId the invoke ID of the request + * \param[out] mmsError user provided variable to store error code + * \param[in] domainId the domain name of the variable to be read + * \param[in] itemId name of the variable to be read + * \param[in] startIndex index of element to read or start index if a element range is to be read + * \param[in] numberOfElements Number of elements to read or 0 if a single element is to be read */ -LIB61850_API uint32_t -MmsConnection_readArrayElementsAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +LIB61850_API void +MmsConnection_readArrayElementsAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, uint32_t startIndex, uint32_t numberOfElements, MmsConnection_ReadVariableHandler handler, void* parameter); @@ -596,8 +591,8 @@ LIB61850_API MmsValue* MmsConnection_readSingleArrayElementWithComponent(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, uint32_t index, const char* componentId); -LIB61850_API uint32_t -MmsConnection_readSingleArrayElementWithComponentAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_readSingleArrayElementWithComponentAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, uint32_t index, const char* componentId, MmsConnection_ReadVariableHandler handler, void* parameter); @@ -618,8 +613,8 @@ LIB61850_API MmsValue* MmsConnection_readMultipleVariables(MmsConnection self, MmsError* mmsError, const char* domainId, LinkedList /**/ items); -LIB61850_API uint32_t -MmsConnection_readMultipleVariablesAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_readMultipleVariablesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, LinkedList /**/items, MmsConnection_ReadVariableHandler handler, void* parameter); @@ -643,8 +638,8 @@ MmsConnection_writeVariable(MmsConnection self, MmsError* mmsError, typedef void (*MmsConnection_WriteVariableHandler) (uint32_t invokeId, void* parameter, MmsError mmsError, MmsDataAccessError accessError); -LIB61850_API uint32_t -MmsConnection_writeVariableAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_writeVariableAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* value, MmsConnection_WriteVariableHandler handler, void* parameter); @@ -667,8 +662,8 @@ MmsConnection_writeSingleArrayElementWithComponent(MmsConnection self, MmsError* const char* domainId, const char* itemId, uint32_t arrayIndex, const char* componentId, MmsValue* value); -LIB61850_API uint32_t -MmsConnection_writeSingleArrayElementWithComponentAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_writeSingleArrayElementWithComponentAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, uint32_t arrayIndex, const char* componentId, MmsValue* value, MmsConnection_WriteVariableHandler handler, void* parameter); @@ -696,8 +691,8 @@ MmsConnection_writeArrayElements(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, int index, int numberOfElements, MmsValue* value); -LIB61850_API uint32_t -MmsConnection_writeArrayElementsAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_writeArrayElementsAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, int index, int numberOfElements, MmsValue* value, MmsConnection_WriteVariableHandler handler, void* parameter); @@ -729,8 +724,8 @@ MmsConnection_writeMultipleVariables(MmsConnection self, MmsError* mmsError, con LinkedList /**/ items, LinkedList /* */ values, LinkedList* /* */ accessResults); -LIB61850_API uint32_t -MmsConnection_writeMultipleVariablesAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +LIB61850_API void +MmsConnection_writeMultipleVariablesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, LinkedList /**/ items, LinkedList /* */ values, MmsConnection_WriteMultipleVariablesHandler handler, void* parameter); @@ -756,8 +751,8 @@ MmsConnection_writeNamedVariableList(MmsConnection self, MmsError* mmsError, boo LinkedList* /* */accessResults); -LIB61850_API uint32_t -MmsConnection_writeNamedVariableListAsync(MmsConnection self, MmsError* mmsError, bool isAssociationSpecific, +LIB61850_API void +MmsConnection_writeNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, bool isAssociationSpecific, const char* domainId, const char* itemId, LinkedList /* */values, MmsConnection_WriteMultipleVariablesHandler handler, void* parameter); @@ -779,8 +774,8 @@ typedef void (*MmsConnection_GetVariableAccessAttributesHandler) (uint32_t invokeId, void* parameter, MmsError mmsError, MmsVariableSpecification* spec); -LIB61850_API uint32_t -MmsConnection_getVariableAccessAttributesAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_getVariableAccessAttributesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsConnection_GetVariableAccessAttributesHandler, void* parameter); @@ -804,8 +799,8 @@ LIB61850_API MmsValue* MmsConnection_readNamedVariableListValues(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName, bool specWithResult); -LIB61850_API uint32_t -MmsConnection_readNamedVariableListValuesAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_readNamedVariableListValuesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, bool specWithResult, MmsConnection_ReadVariableHandler handler, void* parameter); @@ -826,8 +821,8 @@ LIB61850_API MmsValue* MmsConnection_readNamedVariableListValuesAssociationSpecific(MmsConnection self, MmsError* mmsError, const char* listName, bool specWithResult); -LIB61850_API uint32_t -MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, bool specWithResult, MmsConnection_ReadVariableHandler handler, void* parameter); @@ -848,8 +843,8 @@ LIB61850_API void MmsConnection_defineNamedVariableList(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName, LinkedList variableSpecs); -LIB61850_API uint32_t -MmsConnection_defineNamedVariableListAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +LIB61850_API void +MmsConnection_defineNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, LinkedList variableSpecs, MmsConnection_GenericServiceHandler handler, void* parameter); @@ -868,8 +863,8 @@ LIB61850_API void MmsConnection_defineNamedVariableListAssociationSpecific(MmsConnection self, MmsError* mmsError, const char* listName, LinkedList variableSpecs); -LIB61850_API uint32_t -MmsConnection_defineNamedVariableListAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_defineNamedVariableListAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, LinkedList variableSpecs, MmsConnection_GenericServiceHandler handler, void* parameter); @@ -897,8 +892,8 @@ typedef void (*MmsConnection_ReadNVLDirectoryHandler) (uint32_t invokeId, void* parameter, MmsError mmsError, LinkedList /* */ specs, bool deletable); -LIB61850_API uint32_t -MmsConnection_readNamedVariableListDirectoryAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_readNamedVariableListDirectoryAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, MmsConnection_ReadNVLDirectoryHandler handler, void* parameter); @@ -916,8 +911,8 @@ LIB61850_API LinkedList /* */ MmsConnection_readNamedVariableListDirectoryAssociationSpecific(MmsConnection self, MmsError* mmsError, const char* listName, bool* deletable); -LIB61850_API uint32_t -MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, MmsConnection_ReadNVLDirectoryHandler handler, void* parameter); @@ -938,8 +933,8 @@ LIB61850_API bool MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName); -LIB61850_API uint32_t -MmsConnection_deleteNamedVariableListAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName, +LIB61850_API void +MmsConnection_deleteNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, MmsConnection_GenericServiceHandler handler, void* parameter); /** @@ -956,8 +951,8 @@ MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, Mms const char* listName); -LIB61850_API uint32_t -MmsConnection_deleteAssociationSpecificNamedVariableListAsync(MmsConnection self, MmsError* mmsError, const char* listName, +LIB61850_API void +MmsConnection_deleteAssociationSpecificNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, MmsConnection_GenericServiceHandler handler, void* parameter); /** @@ -1033,8 +1028,8 @@ typedef void (*MmsConnection_IdentifyHandler) (uint32_t invokeId, void* parameter, MmsError mmsError, char* vendorName, char* modelName, char* revision); -LIB61850_API uint32_t -MmsConnection_identifyAsync(MmsConnection self, MmsError* mmsError, +LIB61850_API void +MmsConnection_identifyAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, MmsConnection_IdentifyHandler handler, void* parameter); LIB61850_API void @@ -1059,8 +1054,8 @@ MmsConnection_getServerStatus(MmsConnection self, MmsError* mmsError, int* vmdLo typedef void (*MmsConnection_GetServerStatusHandler) (uint32_t invokeId, void* parameter, MmsError mmsError, int vmdLogicalStatus, int vmdPhysicalStatus); -LIB61850_API uint32_t -MmsConnection_getServerStatusAsync(MmsConnection self, MmsError* mmsError, bool extendedDerivation, +LIB61850_API void +MmsConnection_getServerStatusAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, bool extendedDerivation, MmsConnection_GetServerStatusHandler handler, void* parameter); /******************************************************************************* @@ -1117,8 +1112,8 @@ MmsConnection_fileOpen(MmsConnection self, MmsError* mmsError, const char* filen typedef void (*MmsConnection_FileOpenHandler) (uint32_t invokeId, void* parameter, MmsError mmsError, int32_t frsmId, uint32_t fileSize, uint64_t lastModified); -LIB61850_API uint32_t -MmsConnection_fileOpenAsync(MmsConnection self, MmsError* mmsError, const char* filename, uint32_t initialPosition, MmsConnection_FileOpenHandler handler, +LIB61850_API void +MmsConnection_fileOpenAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* filename, uint32_t initialPosition, MmsConnection_FileOpenHandler handler, void* parameter); @@ -1136,8 +1131,8 @@ MmsConnection_fileOpenAsync(MmsConnection self, MmsError* mmsError, const char* LIB61850_API bool MmsConnection_fileRead(MmsConnection self, MmsError* mmsError, int32_t frsmId, MmsFileReadHandler handler, void* handlerParameter); -LIB61850_API uint32_t -MmsConnection_fileReadAsync(MmsConnection self, MmsError* mmsError, int32_t frsmId, MmsConnection_FileReadHandler handler, void* parameter); +LIB61850_API void +MmsConnection_fileReadAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, int32_t frsmId, MmsConnection_FileReadHandler handler, void* parameter); /** * \brief close the file with the specified frsmID @@ -1149,8 +1144,8 @@ MmsConnection_fileReadAsync(MmsConnection self, MmsError* mmsError, int32_t frsm LIB61850_API void MmsConnection_fileClose(MmsConnection self, MmsError* mmsError, int32_t frsmId); -LIB61850_API uint32_t -MmsConnection_fileCloseAsync(MmsConnection self, MmsError* mmsError, uint32_t frsmId, MmsConnection_GenericServiceHandler handler, void* parameter); +LIB61850_API void +MmsConnection_fileCloseAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, uint32_t frsmId, MmsConnection_GenericServiceHandler handler, void* parameter); /** * \brief delete the file with the specified name @@ -1162,8 +1157,8 @@ MmsConnection_fileCloseAsync(MmsConnection self, MmsError* mmsError, uint32_t fr LIB61850_API void MmsConnection_fileDelete(MmsConnection self, MmsError* mmsError, const char* fileName); -LIB61850_API uint32_t -MmsConnection_fileDeleteAsync(MmsConnection self, MmsError* mmsError, const char* fileName, +LIB61850_API void +MmsConnection_fileDeleteAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* fileName, MmsConnection_GenericServiceHandler handler, void* parameter); /** @@ -1177,8 +1172,8 @@ MmsConnection_fileDeleteAsync(MmsConnection self, MmsError* mmsError, const char LIB61850_API void MmsConnection_fileRename(MmsConnection self, MmsError* mmsError, const char* currentFileName, const char* newFileName); -LIB61850_API uint32_t -MmsConnection_fileRenameAsync(MmsConnection self, MmsError* mmsError, const char* currentFileName, const char* newFileName, +LIB61850_API void +MmsConnection_fileRenameAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* currentFileName, const char* newFileName, MmsConnection_GenericServiceHandler handler, void* parameter); /** @@ -1192,8 +1187,8 @@ MmsConnection_fileRenameAsync(MmsConnection self, MmsError* mmsError, const char LIB61850_API void MmsConnection_obtainFile(MmsConnection self, MmsError* mmsError, const char* sourceFile, const char* destinationFile); -LIB61850_API uint32_t -MmsConnection_obtainFileAsync(MmsConnection self, MmsError* mmsError, const char* sourceFile, const char* destinationFile, +LIB61850_API void +MmsConnection_obtainFileAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* sourceFile, const char* destinationFile, MmsConnection_GenericServiceHandler handler, void* parameter); /** @@ -1216,8 +1211,8 @@ LIB61850_API bool MmsConnection_getFileDirectory(MmsConnection self, MmsError* mmsError, const char* fileSpecification, const char* continueAfter, MmsFileDirectoryHandler handler, void* handlerParameter); -LIB61850_API uint32_t -MmsConnection_getFileDirectoryAsync(MmsConnection self, MmsError* mmsError, const char* fileSpecification, const char* continueAfter, +LIB61850_API void +MmsConnection_getFileDirectoryAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* fileSpecification, const char* continueAfter, MmsConnection_FileDirectoryHandler handler, void* parameter); typedef struct sMmsJournalEntry* MmsJournalEntry; @@ -1274,16 +1269,16 @@ LIB61850_API LinkedList /* */ MmsConnection_readJournalTimeRange(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* startTime, MmsValue* endTime, bool* moreFollows); -LIB61850_API uint32_t -MmsConnection_readJournalTimeRangeAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +LIB61850_API void +MmsConnection_readJournalTimeRangeAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* startTime, MmsValue* endTime, MmsConnection_ReadJournalHandler handler, void* parameter); LIB61850_API LinkedList /* */ MmsConnection_readJournalStartAfter(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* timeSpecification, MmsValue* entrySpecification, bool* moreFollows); -LIB61850_API uint32_t -MmsConnection_readJournalStartAfterAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +LIB61850_API void +MmsConnection_readJournalStartAfterAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* timeSpecification, MmsValue* entrySpecification, MmsConnection_ReadJournalHandler handler, void* parameter); /** diff --git a/src/mms/iso_mms/client/mms_client_connection.c b/src/mms/iso_mms/client/mms_client_connection.c index 241ddcb4..e4bd2ae5 100644 --- a/src/mms/iso_mms/client/mms_client_connection.c +++ b/src/mms/iso_mms/client/mms_client_connection.c @@ -1932,9 +1932,10 @@ MmsConnection_setInformationReportHandler(MmsConnection self, MmsInformationRepo self->reportHandlerParameter = parameter; } -static uint32_t +static void mmsClient_getNameListSingleRequestAsync( MmsConnection self, + uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, MmsObjectClass objectClass, @@ -1944,8 +1945,6 @@ mmsClient_getNameListSingleRequestAsync( void* parameter, LinkedList nameList) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -1954,7 +1953,10 @@ mmsClient_getNameListSingleRequestAsync( ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; if (associationSpecific) mmsClient_createMmsGetNameListRequestAssociationSpecific(invokeId, @@ -1978,7 +1980,7 @@ mmsClient_getNameListSingleRequestAsync( *mmsError = err; exit_function: - return invokeId; + return; } struct getNameListParameters @@ -2024,7 +2026,7 @@ mmsClient_getNameList(MmsConnection self, MmsError *mmsError, Semaphore_wait(parameter.sem); - mmsClient_getNameListSingleRequestAsync(self, &err, domainId, objectClass, associationSpecific, NULL, + mmsClient_getNameListSingleRequestAsync(self, NULL, &err, domainId, objectClass, associationSpecific, NULL, getNameListHandler, ¶meter, NULL); if (err == MMS_ERROR_NONE) { @@ -2046,7 +2048,7 @@ mmsClient_getNameList(MmsConnection self, MmsError *mmsError, Semaphore_wait(parameter.sem); - mmsClient_getNameListSingleRequestAsync(self, &err, domainId, objectClass, associationSpecific, continueAfter, + mmsClient_getNameListSingleRequestAsync(self, NULL, &err, domainId, objectClass, associationSpecific, continueAfter, getNameListHandler, ¶meter, list); if (err == MMS_ERROR_NONE) { @@ -2078,11 +2080,11 @@ MmsConnection_getVMDVariableNames(MmsConnection self, MmsError* mmsError) return mmsClient_getNameList(self, mmsError, NULL, MMS_OBJECT_CLASS_NAMED_VARIABLE, false); } -uint32_t -MmsConnection_getVMDVariableNamesAsync(MmsConnection self, MmsError* mmsError, const char* continueAfter, +void +MmsConnection_getVMDVariableNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* continueAfter, MmsConnection_GetNameListHandler handler, void* parameter) { - return mmsClient_getNameListSingleRequestAsync(self, mmsError, NULL, MMS_OBJECT_CLASS_NAMED_VARIABLE, + mmsClient_getNameListSingleRequestAsync(self, usedInvokeId, mmsError, NULL, MMS_OBJECT_CLASS_NAMED_VARIABLE, false, continueAfter, handler, parameter, NULL); } @@ -2092,11 +2094,11 @@ MmsConnection_getDomainNames(MmsConnection self, MmsError* mmsError) return mmsClient_getNameList(self, mmsError, NULL, MMS_OBJECT_CLASS_DOMAIN, false); } -uint32_t -MmsConnection_getDomainNamesAsync(MmsConnection self, MmsError* mmsError, const char* continueAfter, LinkedList result, +void +MmsConnection_getDomainNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* continueAfter, LinkedList result, MmsConnection_GetNameListHandler handler, void* parameter) { - return mmsClient_getNameListSingleRequestAsync(self, mmsError, NULL, MMS_OBJECT_CLASS_DOMAIN, false, + mmsClient_getNameListSingleRequestAsync(self, usedInvokeId, mmsError, NULL, MMS_OBJECT_CLASS_DOMAIN, false, continueAfter, handler, parameter, result); } @@ -2106,11 +2108,11 @@ MmsConnection_getDomainVariableNames(MmsConnection self, MmsError* mmsError, con return mmsClient_getNameList(self, mmsError, domainId, MMS_OBJECT_CLASS_NAMED_VARIABLE, false); } -uint32_t -MmsConnection_getDomainVariableNamesAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +void +MmsConnection_getDomainVariableNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* continueAfter, LinkedList result, MmsConnection_GetNameListHandler handler, void* parameter) { - return mmsClient_getNameListSingleRequestAsync(self, mmsError, domainId, MMS_OBJECT_CLASS_NAMED_VARIABLE, false, + mmsClient_getNameListSingleRequestAsync(self, usedInvokeId, mmsError, domainId, MMS_OBJECT_CLASS_NAMED_VARIABLE, false, continueAfter, handler, parameter, result); } @@ -2120,11 +2122,11 @@ MmsConnection_getDomainVariableListNames(MmsConnection self, MmsError* mmsError, return mmsClient_getNameList(self, mmsError, domainId, MMS_OBJECT_CLASS_NAMED_VARIABLE_LIST, false); } -uint32_t -MmsConnection_getDomainVariableListNamesAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +void +MmsConnection_getDomainVariableListNamesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* continueAfter, LinkedList result, MmsConnection_GetNameListHandler handler, void* parameter) { - return mmsClient_getNameListSingleRequestAsync(self, mmsError, domainId, MMS_OBJECT_CLASS_NAMED_VARIABLE_LIST, false, + mmsClient_getNameListSingleRequestAsync(self, usedInvokeId, mmsError, domainId, MMS_OBJECT_CLASS_NAMED_VARIABLE_LIST, false, continueAfter, handler, parameter, result); } @@ -2134,11 +2136,11 @@ MmsConnection_getDomainJournals(MmsConnection self, MmsError* mmsError, const ch return mmsClient_getNameList(self, mmsError, domainId, MMS_OBJECT_CLASS_JOURNAL, false); } -uint32_t -MmsConnection_getDomainJournalsAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +void +MmsConnection_getDomainJournalsAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* continueAfter, MmsConnection_GetNameListHandler handler, void* parameter) { - return mmsClient_getNameListSingleRequestAsync(self, mmsError, domainId, MMS_OBJECT_CLASS_JOURNAL, false, + mmsClient_getNameListSingleRequestAsync(self, usedInvokeId, mmsError, domainId, MMS_OBJECT_CLASS_JOURNAL, false, continueAfter, handler, parameter, NULL); } @@ -2148,11 +2150,11 @@ MmsConnection_getVariableListNamesAssociationSpecific(MmsConnection self, MmsErr return mmsClient_getNameList(self, mmsError, NULL, MMS_OBJECT_CLASS_NAMED_VARIABLE_LIST, true); } -uint32_t -MmsConnection_getVariableListNamesAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_getVariableListNamesAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* continueAfter, MmsConnection_GetNameListHandler handler, void* parameter) { - return mmsClient_getNameListSingleRequestAsync(self, mmsError, NULL, MMS_OBJECT_CLASS_NAMED_VARIABLE_LIST, true, + mmsClient_getNameListSingleRequestAsync(self, usedInvokeId, mmsError, NULL, MMS_OBJECT_CLASS_NAMED_VARIABLE_LIST, true, continueAfter, handler, parameter, NULL); } @@ -2178,12 +2180,10 @@ readVariableHandler(uint32_t invokeId, void* parameter, MmsError mmsError, MmsVa Semaphore_post(parameters->sem); } -uint32_t -MmsConnection_readVariableAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +void +MmsConnection_readVariableAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsConnection_ReadVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2193,7 +2193,10 @@ MmsConnection_readVariableAsync(MmsConnection self, MmsError* mmsError, const ch ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadRequest(invokeId, domainId, itemId, payload); @@ -2206,7 +2209,7 @@ MmsConnection_readVariableAsync(MmsConnection self, MmsError* mmsError, const ch *mmsError = err; exit_function: - return invokeId; + return; } MmsValue* @@ -2224,7 +2227,7 @@ MmsConnection_readVariable(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.sem); - MmsConnection_readVariableAsync(self, &err, domainId, itemId, readVariableHandler, ¶meter); + MmsConnection_readVariableAsync(self, NULL, &err, domainId, itemId, readVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.sem); @@ -2241,13 +2244,11 @@ MmsConnection_readVariable(MmsConnection self, MmsError* mmsError, return value; } -uint32_t -MmsConnection_readVariableComponentAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_readVariableComponentAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, const char* componentId, MmsConnection_ReadVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2257,7 +2258,10 @@ MmsConnection_readVariableComponentAsync(MmsConnection self, MmsError* mmsError, ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadRequestComponent(invokeId, domainId, itemId, componentId, payload); @@ -2270,7 +2274,7 @@ MmsConnection_readVariableComponentAsync(MmsConnection self, MmsError* mmsError, *mmsError = err; exit_function: - return invokeId; + return; } MmsValue* @@ -2288,7 +2292,7 @@ MmsConnection_readVariableComponent(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.sem); - MmsConnection_readVariableComponentAsync(self, &err, domainId, itemId, componentId, readVariableHandler, ¶meter); + MmsConnection_readVariableComponentAsync(self, NULL, &err, domainId, itemId, componentId, readVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.sem); @@ -2321,7 +2325,7 @@ MmsConnection_readArrayElements(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.sem); - MmsConnection_readArrayElementsAsync(self, &err, domainId, itemId, startIndex, numberOfElements, + MmsConnection_readArrayElementsAsync(self, NULL, &err, domainId, itemId, startIndex, numberOfElements, readVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2339,13 +2343,11 @@ MmsConnection_readArrayElements(MmsConnection self, MmsError* mmsError, return value; } -uint32_t -MmsConnection_readArrayElementsAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +void +MmsConnection_readArrayElementsAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, uint32_t startIndex, uint32_t numberOfElements, MmsConnection_ReadVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2354,7 +2356,10 @@ MmsConnection_readArrayElementsAsync(MmsConnection self, MmsError* mmsError, con ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadRequestAlternateAccessIndex(invokeId, domainId, itemId, startIndex, numberOfElements, payload); @@ -2368,7 +2373,7 @@ MmsConnection_readArrayElementsAsync(MmsConnection self, MmsError* mmsError, con *mmsError = err; exit_function: - return invokeId; + return; } MmsValue* @@ -2386,7 +2391,7 @@ MmsConnection_readSingleArrayElementWithComponent(MmsConnection self, MmsError* Semaphore_wait(parameter.sem); - MmsConnection_readSingleArrayElementWithComponentAsync(self, &err, domainId, itemId, index, componentId, + MmsConnection_readSingleArrayElementWithComponentAsync(self, NULL, &err, domainId, itemId, index, componentId, readVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2404,14 +2409,13 @@ MmsConnection_readSingleArrayElementWithComponent(MmsConnection self, MmsError* return value; } -uint32_t -MmsConnection_readSingleArrayElementWithComponentAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_readSingleArrayElementWithComponentAsync(MmsConnection self, uint32_t* usedInvokeId, + MmsError* mmsError, const char* domainId, const char* itemId, uint32_t index, const char* componentId, MmsConnection_ReadVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2420,7 +2424,10 @@ MmsConnection_readSingleArrayElementWithComponentAsync(MmsConnection self, MmsEr ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadRequestAlternateAccessSingleIndexComponent(invokeId, domainId, itemId, index, componentId, payload); @@ -2434,7 +2441,7 @@ MmsConnection_readSingleArrayElementWithComponentAsync(MmsConnection self, MmsEr *mmsError = err; exit_function: - return invokeId; + return; } MmsValue* @@ -2452,7 +2459,7 @@ MmsConnection_readMultipleVariables(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.sem); - MmsConnection_readMultipleVariablesAsync(self, &err, domainId, items, + MmsConnection_readMultipleVariablesAsync(self, NULL, &err, domainId, items, readVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2470,13 +2477,11 @@ MmsConnection_readMultipleVariables(MmsConnection self, MmsError* mmsError, return value; } -uint32_t -MmsConnection_readMultipleVariablesAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_readMultipleVariablesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, LinkedList /**/items, MmsConnection_ReadVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2485,7 +2490,10 @@ MmsConnection_readMultipleVariablesAsync(MmsConnection self, MmsError* mmsError, ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; if (mmsClient_createReadRequestMultipleValues(invokeId, domainId, items, payload) > 0) { MmsClientInternalParameter intParam; @@ -2502,7 +2510,7 @@ MmsConnection_readMultipleVariablesAsync(MmsConnection self, MmsError* mmsError, } exit_function: - return invokeId; + return; } MmsValue* @@ -2521,7 +2529,7 @@ MmsConnection_readNamedVariableListValues(MmsConnection self, MmsError* mmsError Semaphore_wait(parameter.sem); - MmsConnection_readNamedVariableListValuesAsync(self, &err, domainId, listName, specWithResult, + MmsConnection_readNamedVariableListValuesAsync(self, NULL, &err, domainId, listName, specWithResult, readVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2539,13 +2547,11 @@ MmsConnection_readNamedVariableListValues(MmsConnection self, MmsError* mmsError return value; } -uint32_t -MmsConnection_readNamedVariableListValuesAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_readNamedVariableListValuesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, bool specWithResult, MmsConnection_ReadVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2554,7 +2560,10 @@ MmsConnection_readNamedVariableListValuesAsync(MmsConnection self, MmsError* mms ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadNamedVariableListRequest(invokeId, domainId, listName, payload, specWithResult); @@ -2568,7 +2577,7 @@ MmsConnection_readNamedVariableListValuesAsync(MmsConnection self, MmsError* mms *mmsError = err; exit_function: - return invokeId; + return; } MmsValue* @@ -2588,7 +2597,7 @@ MmsConnection_readNamedVariableListValuesAssociationSpecific( Semaphore_wait(parameter.sem); - MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(self, &err, listName, specWithResult, + MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(self, NULL, &err, listName, specWithResult, readVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2606,13 +2615,11 @@ MmsConnection_readNamedVariableListValuesAssociationSpecific( return value; } -uint32_t -MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, bool specWithResult, MmsConnection_ReadVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2621,7 +2628,10 @@ MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(MmsConnection ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadAssociationSpecificNamedVariableListRequest(invokeId, listName, payload, specWithResult); @@ -2635,7 +2645,7 @@ MmsConnection_readNamedVariableListValuesAssociationSpecificAsync(MmsConnection *mmsError = err; exit_function: - return invokeId; + return; } struct readNVLDirectoryParameters @@ -2677,7 +2687,7 @@ MmsConnection_readNamedVariableListDirectory(MmsConnection self, MmsError* mmsEr parameter.waitForResponse = waitForResponse; - MmsConnection_readNamedVariableListDirectoryAsync(self, &err, domainId, listName, + MmsConnection_readNamedVariableListDirectoryAsync(self, NULL, &err, domainId, listName, readNVLDirectoryHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2697,13 +2707,11 @@ MmsConnection_readNamedVariableListDirectory(MmsConnection self, MmsError* mmsEr return specs; } -uint32_t -MmsConnection_readNamedVariableListDirectoryAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_readNamedVariableListDirectoryAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, MmsConnection_ReadNVLDirectoryHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2712,7 +2720,10 @@ MmsConnection_readNamedVariableListDirectoryAsync(MmsConnection self, MmsError* ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createGetNamedVariableListAttributesRequest(invokeId, payload, domainId, listName); @@ -2726,7 +2737,7 @@ MmsConnection_readNamedVariableListDirectoryAsync(MmsConnection self, MmsError* *mmsError = err; exit_function: - return invokeId; + return; } LinkedList /* */ @@ -2745,7 +2756,7 @@ MmsConnection_readNamedVariableListDirectoryAssociationSpecific(MmsConnection se parameter.waitForResponse = waitForResponse; - MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(self, &err, listName, + MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(self, NULL, &err, listName, readNVLDirectoryHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2765,13 +2776,11 @@ MmsConnection_readNamedVariableListDirectoryAssociationSpecific(MmsConnection se return specs; } -uint32_t -MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, MmsConnection_ReadNVLDirectoryHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2780,7 +2789,10 @@ MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(MmsConnecti ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createGetNamedVariableListAttributesRequestAssociationSpecific(invokeId, payload, listName); @@ -2794,7 +2806,7 @@ MmsConnection_readNamedVariableListDirectoryAssociationSpecificAsync(MmsConnecti *mmsError = err; exit_function: - return invokeId; + return; } struct defineNVLParameters @@ -2831,7 +2843,7 @@ MmsConnection_defineNamedVariableList(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.waitForResponse); - MmsConnection_defineNamedVariableListAsync(self, &err, domainId, listName, variableSpecs, + MmsConnection_defineNamedVariableListAsync(self, NULL, &err, domainId, listName, variableSpecs, defineNVLHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2845,13 +2857,11 @@ MmsConnection_defineNamedVariableList(MmsConnection self, MmsError* mmsError, *mmsError = err; } -uint32_t -MmsConnection_defineNamedVariableListAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +void +MmsConnection_defineNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, LinkedList variableSpecs, MmsConnection_GenericServiceHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2860,7 +2870,10 @@ MmsConnection_defineNamedVariableListAsync(MmsConnection self, MmsError* mmsErro ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createDefineNamedVariableListRequest(invokeId, payload, domainId, listName, variableSpecs, false); @@ -2874,7 +2887,7 @@ MmsConnection_defineNamedVariableListAsync(MmsConnection self, MmsError* mmsErro *mmsError = err; exit_function: - return invokeId; + return; } void @@ -2889,7 +2902,7 @@ MmsConnection_defineNamedVariableListAssociationSpecific(MmsConnection self, Semaphore_wait(parameter.waitForResponse); - MmsConnection_defineNamedVariableListAssociationSpecificAsync(self, &err, listName, variableSpecs, + MmsConnection_defineNamedVariableListAssociationSpecificAsync(self, NULL, &err, listName, variableSpecs, defineNVLHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -2903,13 +2916,11 @@ MmsConnection_defineNamedVariableListAssociationSpecific(MmsConnection self, *mmsError = err; } -uint32_t -MmsConnection_defineNamedVariableListAssociationSpecificAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_defineNamedVariableListAssociationSpecificAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, LinkedList variableSpecs, MmsConnection_GenericServiceHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2918,7 +2929,10 @@ MmsConnection_defineNamedVariableListAssociationSpecificAsync(MmsConnection self ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createDefineNamedVariableListRequest(invokeId, payload, NULL, listName, variableSpecs, true); @@ -2932,7 +2946,7 @@ MmsConnection_defineNamedVariableListAssociationSpecificAsync(MmsConnection self *mmsError = err; exit_function: - return invokeId; + return; } bool @@ -2949,7 +2963,7 @@ MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.waitForResponse); - MmsConnection_deleteNamedVariableListAsync(self, &err, domainId, listName, defineNVLHandler, ¶meter); + MmsConnection_deleteNamedVariableListAsync(self, NULL, &err, domainId, listName, defineNVLHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -2965,12 +2979,10 @@ MmsConnection_deleteNamedVariableList(MmsConnection self, MmsError* mmsError, return isDeleted; } -uint32_t -MmsConnection_deleteNamedVariableListAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* listName, +void +MmsConnection_deleteNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* listName, MmsConnection_GenericServiceHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -2979,7 +2991,10 @@ MmsConnection_deleteNamedVariableListAsync(MmsConnection self, MmsError* mmsErro ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createDeleteNamedVariableListRequest(invokeId, payload, domainId, listName); @@ -2992,7 +3007,7 @@ MmsConnection_deleteNamedVariableListAsync(MmsConnection self, MmsError* mmsErro *mmsError = err; exit_function: - return invokeId; + return; } bool @@ -3009,7 +3024,7 @@ MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, Semaphore_wait(parameter.waitForResponse); - MmsConnection_deleteAssociationSpecificNamedVariableListAsync(self, &err, listName, defineNVLHandler, ¶meter); + MmsConnection_deleteAssociationSpecificNamedVariableListAsync(self, NULL, &err, listName, defineNVLHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3025,12 +3040,10 @@ MmsConnection_deleteAssociationSpecificNamedVariableList(MmsConnection self, return isDeleted; } -uint32_t -MmsConnection_deleteAssociationSpecificNamedVariableListAsync(MmsConnection self, MmsError* mmsError, const char* listName, +void +MmsConnection_deleteAssociationSpecificNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* listName, MmsConnection_GenericServiceHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -3039,7 +3052,10 @@ MmsConnection_deleteAssociationSpecificNamedVariableListAsync(MmsConnection self ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createDeleteAssociationSpecificNamedVariableListRequest( invokeId, payload, listName); @@ -3053,7 +3069,7 @@ MmsConnection_deleteAssociationSpecificNamedVariableListAsync(MmsConnection self *mmsError = err; exit_function: - return invokeId; + return; } struct getVarAccessAttrParameters @@ -3091,7 +3107,7 @@ MmsConnection_getVariableAccessAttributes(MmsConnection self, MmsError* mmsError Semaphore_wait(parameter.waitForResponse); - MmsConnection_getVariableAccessAttributesAsync(self, &err, domainId, itemId, getAccessAttrHandler, ¶meter); + MmsConnection_getVariableAccessAttributesAsync(self, NULL, &err, domainId, itemId, getAccessAttrHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3107,13 +3123,11 @@ MmsConnection_getVariableAccessAttributes(MmsConnection self, MmsError* mmsError return typeSpec; } -uint32_t -MmsConnection_getVariableAccessAttributesAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_getVariableAccessAttributesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsConnection_GetVariableAccessAttributesHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -3122,7 +3136,10 @@ MmsConnection_getVariableAccessAttributesAsync(MmsConnection self, MmsError* mms ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createGetVariableAccessAttributesRequest(invokeId, domainId, itemId, payload); @@ -3135,7 +3152,7 @@ MmsConnection_getVariableAccessAttributesAsync(MmsConnection self, MmsError* mms *mmsError = err; exit_function: - return invokeId; + return; } struct identifyParameters @@ -3179,7 +3196,7 @@ MmsConnection_identify(MmsConnection self, MmsError* mmsError) Semaphore_wait(parameter.waitForResponse); - MmsConnection_identifyAsync(self, &err, identifyHandler, ¶meter); + MmsConnection_identifyAsync(self, NULL, &err, identifyHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3195,12 +3212,10 @@ MmsConnection_identify(MmsConnection self, MmsError* mmsError) return identity; } -uint32_t -MmsConnection_identifyAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_identifyAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, MmsConnection_IdentifyHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -3209,7 +3224,10 @@ MmsConnection_identifyAsync(MmsConnection self, MmsError* mmsError, ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createIdentifyRequest(invokeId, payload); @@ -3222,7 +3240,7 @@ MmsConnection_identifyAsync(MmsConnection self, MmsError* mmsError, *mmsError = err; exit_function: - return invokeId; + return; } struct getServerStatusParameters @@ -3264,7 +3282,7 @@ MmsConnection_getServerStatus(MmsConnection self, MmsError* mmsError, int* vmdLo Semaphore_wait(parameter.waitForResponse); - MmsConnection_getServerStatusAsync(self, &err, extendedDerivation, getServerStatusHandler, ¶meter); + MmsConnection_getServerStatusAsync(self, NULL, &err, extendedDerivation, getServerStatusHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3283,12 +3301,10 @@ MmsConnection_getServerStatus(MmsConnection self, MmsError* mmsError, int* vmdLo *mmsError = err; } -uint32_t -MmsConnection_getServerStatusAsync(MmsConnection self, MmsError* mmsError, bool extendedDerivation, +void +MmsConnection_getServerStatusAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, bool extendedDerivation, MmsConnection_GetServerStatusHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -3297,7 +3313,10 @@ MmsConnection_getServerStatusAsync(MmsConnection self, MmsError* mmsError, bool ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createStatusRequest(invokeId, payload, extendedDerivation); @@ -3310,7 +3329,7 @@ MmsConnection_getServerStatusAsync(MmsConnection self, MmsError* mmsError, bool *mmsError = err; exit_function: - return invokeId; + return; } static void @@ -3404,7 +3423,7 @@ MmsConnection_readJournalTimeRange(MmsConnection self, MmsError* mmsError, const Semaphore_wait(parameter.waitForResponse); - MmsConnection_readJournalTimeRangeAsync(self, &err, domainId, itemId, startTime, endTime, readJournalHandler, ¶meter); + MmsConnection_readJournalTimeRangeAsync(self, NULL, &err, domainId, itemId, startTime, endTime, readJournalHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3423,12 +3442,10 @@ MmsConnection_readJournalTimeRange(MmsConnection self, MmsError* mmsError, const return parameter.entries; } -uint32_t -MmsConnection_readJournalTimeRangeAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +void +MmsConnection_readJournalTimeRangeAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* startTime, MmsValue* endTime, MmsConnection_ReadJournalHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -3445,7 +3462,10 @@ MmsConnection_readJournalTimeRangeAsync(MmsConnection self, MmsError* mmsError, ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadJournalRequestWithTimeRange(invokeId, payload, domainId, itemId, startTime, endTime); @@ -3458,7 +3478,7 @@ MmsConnection_readJournalTimeRangeAsync(MmsConnection self, MmsError* mmsError, *mmsError = err; exit_function: - return invokeId; + return; } LinkedList @@ -3476,7 +3496,7 @@ MmsConnection_readJournalStartAfter(MmsConnection self, MmsError* mmsError, cons Semaphore_wait(parameter.waitForResponse); - MmsConnection_readJournalStartAfterAsync(self, &err, domainId, itemId, timeSpecification, entrySpecification, readJournalHandler, ¶meter); + MmsConnection_readJournalStartAfterAsync(self, NULL, &err, domainId, itemId, timeSpecification, entrySpecification, readJournalHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3495,12 +3515,10 @@ MmsConnection_readJournalStartAfter(MmsConnection self, MmsError* mmsError, cons return parameter.entries; } -uint32_t -MmsConnection_readJournalStartAfterAsync(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, +void +MmsConnection_readJournalStartAfterAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* timeSpecification, MmsValue* entrySpecification, MmsConnection_ReadJournalHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -3517,7 +3535,10 @@ MmsConnection_readJournalStartAfterAsync(MmsConnection self, MmsError* mmsError, ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createReadJournalRequestStartAfter(invokeId, payload, domainId, itemId, timeSpecification, entrySpecification); @@ -3530,7 +3551,7 @@ MmsConnection_readJournalStartAfterAsync(MmsConnection self, MmsError* mmsError, *mmsError = err; exit_function: - return invokeId; + return; } struct fileOpenParameters @@ -3577,7 +3598,7 @@ MmsConnection_fileOpen(MmsConnection self, MmsError* mmsError, const char* filen Semaphore_wait(parameter.waitForResponse); - MmsConnection_fileOpenAsync(self, &err, filename, initialPosition, fileOpenHandler, ¶meter); + MmsConnection_fileOpenAsync(self, NULL, &err, filename, initialPosition, fileOpenHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3606,12 +3627,11 @@ MmsConnection_fileOpen(MmsConnection self, MmsError* mmsError, const char* filen #endif } -uint32_t -MmsConnection_fileOpenAsync(MmsConnection self, MmsError* mmsError, const char* filename, uint32_t initialPosition, MmsConnection_FileOpenHandler handler, +void +MmsConnection_fileOpenAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* filename, uint32_t initialPosition, MmsConnection_FileOpenHandler handler, void* parameter) { #if (MMS_FILE_SERVICE == 1) - uint32_t invokeId = 0; if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) @@ -3621,7 +3641,10 @@ MmsConnection_fileOpenAsync(MmsConnection self, MmsError* mmsError, const char* ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createFileOpenRequest(invokeId, payload, filename, initialPosition); @@ -3634,13 +3657,13 @@ MmsConnection_fileOpenAsync(MmsConnection self, MmsError* mmsError, const char* *mmsError = err; exit_function: - return invokeId; + return; #else if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: service not supported\n"); *mmsError = MMS_ERROR_OTHER; - return 0; + return; #endif } @@ -3680,7 +3703,7 @@ MmsConnection_fileClose(MmsConnection self, MmsError* mmsError, int32_t frsmId) Semaphore_wait(parameter.waitForResponse); - MmsConnection_fileCloseAsync(self, &err, frsmId, fileOperationHandler, ¶meter); + MmsConnection_fileCloseAsync(self, NULL, &err, frsmId, fileOperationHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3701,11 +3724,10 @@ MmsConnection_fileClose(MmsConnection self, MmsError* mmsError, int32_t frsmId) #endif } -uint32_t -MmsConnection_fileCloseAsync(MmsConnection self, MmsError* mmsError, uint32_t frsmId, MmsConnection_GenericServiceHandler handler, void* parameter) +void +MmsConnection_fileCloseAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, uint32_t frsmId, MmsConnection_GenericServiceHandler handler, void* parameter) { #if (MMS_FILE_SERVICE == 1) - uint32_t invokeId = 0; if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) @@ -3715,7 +3737,10 @@ MmsConnection_fileCloseAsync(MmsConnection self, MmsError* mmsError, uint32_t fr ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createFileCloseRequest(invokeId, payload, frsmId); @@ -3728,13 +3753,13 @@ MmsConnection_fileCloseAsync(MmsConnection self, MmsError* mmsError, uint32_t fr *mmsError = err; exit_function: - return invokeId; + return; #else if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: service not supported\n"); *mmsError = MMS_ERROR_OTHER; - return 0; + return; #endif } @@ -3753,7 +3778,7 @@ MmsConnection_fileDelete(MmsConnection self, MmsError* mmsError, const char* fil Semaphore_wait(parameter.waitForResponse); - MmsConnection_fileDeleteAsync(self, &err, fileName, fileOperationHandler, ¶meter); + MmsConnection_fileDeleteAsync(self, NULL, &err, fileName, fileOperationHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3774,12 +3799,11 @@ MmsConnection_fileDelete(MmsConnection self, MmsError* mmsError, const char* fil #endif } -uint32_t -MmsConnection_fileDeleteAsync(MmsConnection self, MmsError* mmsError, const char* fileName, +void +MmsConnection_fileDeleteAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* fileName, MmsConnection_GenericServiceHandler handler, void* parameter) { #if (MMS_FILE_SERVICE == 1) - uint32_t invokeId = 0; if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) @@ -3789,7 +3813,10 @@ MmsConnection_fileDeleteAsync(MmsConnection self, MmsError* mmsError, const char ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createFileDeleteRequest(invokeId, payload, fileName); @@ -3802,13 +3829,13 @@ MmsConnection_fileDeleteAsync(MmsConnection self, MmsError* mmsError, const char *mmsError = err; exit_function: - return invokeId; + return; #else if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: service not supported\n"); *mmsError = MMS_ERROR_OTHER; - return 0; + return; #endif } @@ -3858,7 +3885,7 @@ MmsConnection_fileRead(MmsConnection self, MmsError* mmsError, int32_t frsmId, M Semaphore_wait(parameter.waitForResponse); - MmsConnection_fileReadAsync(self, &err, frsmId, fileReadHandler, ¶meter); + MmsConnection_fileReadAsync(self, NULL, &err, frsmId, fileReadHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3882,11 +3909,10 @@ MmsConnection_fileRead(MmsConnection self, MmsError* mmsError, int32_t frsmId, M #endif } -uint32_t -MmsConnection_fileReadAsync(MmsConnection self, MmsError* mmsError, int32_t frsmId, MmsConnection_FileReadHandler handler, void* parameter) +void +MmsConnection_fileReadAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, int32_t frsmId, MmsConnection_FileReadHandler handler, void* parameter) { #if (MMS_FILE_SERVICE == 1) - uint32_t invokeId = 0; if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) @@ -3896,7 +3922,10 @@ MmsConnection_fileReadAsync(MmsConnection self, MmsError* mmsError, int32_t frsm ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createFileReadRequest(invokeId, payload, frsmId); @@ -3909,13 +3938,13 @@ MmsConnection_fileReadAsync(MmsConnection self, MmsError* mmsError, int32_t frsm *mmsError = err; exit_function: - return invokeId; + return; #else if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: service not supported\n"); *mmsError = MMS_ERROR_OTHER; - return 0; + return; #endif } @@ -3967,7 +3996,7 @@ MmsConnection_getFileDirectory(MmsConnection self, MmsError* mmsError, const cha Semaphore_wait(parameter.waitForResponse); - MmsConnection_getFileDirectoryAsync(self, &err, fileSpecification, continueAfter, getFileDirHandler, ¶meter); + MmsConnection_getFileDirectoryAsync(self, NULL, &err, fileSpecification, continueAfter, getFileDirHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -3990,12 +4019,11 @@ MmsConnection_getFileDirectory(MmsConnection self, MmsError* mmsError, const cha #endif } -uint32_t -MmsConnection_getFileDirectoryAsync(MmsConnection self, MmsError* mmsError, const char* fileSpecification, const char* continueAfter, +void +MmsConnection_getFileDirectoryAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* fileSpecification, const char* continueAfter, MmsConnection_FileDirectoryHandler handler, void* parameter) { #if (MMS_FILE_SERVICE == 1) - uint32_t invokeId = 0; if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) @@ -4005,7 +4033,10 @@ MmsConnection_getFileDirectoryAsync(MmsConnection self, MmsError* mmsError, cons ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createFileDirectoryRequest(invokeId, payload, fileSpecification, continueAfter); @@ -4018,13 +4049,13 @@ MmsConnection_getFileDirectoryAsync(MmsConnection self, MmsError* mmsError, cons *mmsError = err; exit_function: - return invokeId; + return; #else if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: service not supported\n"); *mmsError = MMS_ERROR_OTHER; - return 0; + return; #endif } @@ -4043,7 +4074,7 @@ MmsConnection_fileRename(MmsConnection self, MmsError* mmsError, const char* cur Semaphore_wait(parameter.waitForResponse); - MmsConnection_fileRenameAsync(self, &err, currentFileName, newFileName, fileOperationHandler, ¶meter); + MmsConnection_fileRenameAsync(self, NULL, &err, currentFileName, newFileName, fileOperationHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -4063,12 +4094,11 @@ MmsConnection_fileRename(MmsConnection self, MmsError* mmsError, const char* cur #endif } -uint32_t -MmsConnection_fileRenameAsync(MmsConnection self, MmsError* mmsError, const char* currentFileName, const char* newFileName, +void +MmsConnection_fileRenameAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* currentFileName, const char* newFileName, MmsConnection_GenericServiceHandler handler, void* parameter) { #if (MMS_FILE_SERVICE == 1) - uint32_t invokeId = 0; if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) @@ -4078,7 +4108,10 @@ MmsConnection_fileRenameAsync(MmsConnection self, MmsError* mmsError, const char ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createFileRenameRequest(invokeId, payload, currentFileName, newFileName); @@ -4091,13 +4124,13 @@ MmsConnection_fileRenameAsync(MmsConnection self, MmsError* mmsError, const char *mmsError = err; exit_function: - return invokeId; + return; #else if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: service not supported\n"); *mmsError = MMS_ERROR_OTHER; - return 0; + return; #endif } @@ -4116,7 +4149,7 @@ MmsConnection_obtainFile(MmsConnection self, MmsError* mmsError, const char* sou Semaphore_wait(parameter.waitForResponse); - MmsConnection_obtainFileAsync(self, &err, sourceFile, destinationFile, fileOperationHandler, ¶meter); + MmsConnection_obtainFileAsync(self, NULL, &err, sourceFile, destinationFile, fileOperationHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -4144,12 +4177,11 @@ struct writeVariableParameters MmsDataAccessError accessError; }; -uint32_t -MmsConnection_obtainFileAsync(MmsConnection self, MmsError* mmsError, const char* sourceFile, const char* destinationFile, +void +MmsConnection_obtainFileAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* sourceFile, const char* destinationFile, MmsConnection_GenericServiceHandler handler, void* parameter) { #if (MMS_FILE_SERVICE == 1) - uint32_t invokeId = 0; if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) @@ -4159,7 +4191,10 @@ MmsConnection_obtainFileAsync(MmsConnection self, MmsError* mmsError, const char ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createObtainFileRequest(invokeId, payload, sourceFile, destinationFile); @@ -4176,13 +4211,13 @@ MmsConnection_obtainFileAsync(MmsConnection self, MmsError* mmsError, const char *mmsError = err; exit_function: - return invokeId; + return; #else if (DEBUG_MMS_CLIENT) printf("MMS_CLIENT: service not supported\n"); *mmsError = MMS_ERROR_OTHER; - return 0; + return; #endif } @@ -4215,7 +4250,7 @@ MmsConnection_writeVariable(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.waitForResponse); - MmsConnection_writeVariableAsync(self, &err, domainId, itemId, value, writeVariableHandler, ¶meter); + MmsConnection_writeVariableAsync(self, NULL, &err, domainId, itemId, value, writeVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -4231,13 +4266,11 @@ MmsConnection_writeVariable(MmsConnection self, MmsError* mmsError, return parameter.accessError; } -uint32_t -MmsConnection_writeVariableAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_writeVariableAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, MmsValue* value, MmsConnection_WriteVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -4246,7 +4279,10 @@ MmsConnection_writeVariableAsync(MmsConnection self, MmsError* mmsError, ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createWriteRequest(invokeId, domainId, itemId, value, payload); @@ -4259,7 +4295,7 @@ MmsConnection_writeVariableAsync(MmsConnection self, MmsError* mmsError, *mmsError = err; exit_function: - return invokeId; + return; } MmsDataAccessError @@ -4277,7 +4313,7 @@ MmsConnection_writeSingleArrayElementWithComponent(MmsConnection self, MmsError* Semaphore_wait(parameter.waitForResponse); - MmsConnection_writeSingleArrayElementWithComponentAsync(self, &err, domainId, itemId, arrayIndex, componentId, value, writeVariableHandler, ¶meter); + MmsConnection_writeSingleArrayElementWithComponentAsync(self, NULL, &err, domainId, itemId, arrayIndex, componentId, value, writeVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -4293,14 +4329,12 @@ MmsConnection_writeSingleArrayElementWithComponent(MmsConnection self, MmsError* return parameter.accessError; } -uint32_t -MmsConnection_writeSingleArrayElementWithComponentAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_writeSingleArrayElementWithComponentAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, uint32_t arrayIndex, const char* componentId, MmsValue* value, MmsConnection_WriteVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -4309,7 +4343,10 @@ MmsConnection_writeSingleArrayElementWithComponentAsync(MmsConnection self, MmsE ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createWriteRequestAlternateAccessSingleIndexComponent(invokeId, domainId, itemId, arrayIndex, componentId, value, payload); @@ -4323,7 +4360,7 @@ MmsConnection_writeSingleArrayElementWithComponentAsync(MmsConnection self, MmsE *mmsError = err; exit_function: - return invokeId; + return; } struct writeMultipleVariablesParameter @@ -4363,7 +4400,7 @@ MmsConnection_writeMultipleVariables(MmsConnection self, MmsError* mmsError, con Semaphore_wait(parameter.sem); - MmsConnection_writeMultipleVariablesAsync(self, &err, domainId, items, values, writeMultipleVariablesHandler, ¶meter); + MmsConnection_writeMultipleVariablesAsync(self, NULL, &err, domainId, items, values, writeMultipleVariablesHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -4387,13 +4424,11 @@ MmsConnection_writeMultipleVariables(MmsConnection self, MmsError* mmsError, con Semaphore_destroy(parameter.sem); } -uint32_t -MmsConnection_writeMultipleVariablesAsync(MmsConnection self, MmsError* mmsError, const char* domainId, +void +MmsConnection_writeMultipleVariablesAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, LinkedList /**/ items, LinkedList /* */ values, MmsConnection_WriteMultipleVariablesHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -4402,7 +4437,10 @@ MmsConnection_writeMultipleVariablesAsync(MmsConnection self, MmsError* mmsError ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; if (mmsClient_createWriteMultipleItemsRequest(invokeId, domainId, items, values, payload) != -1) { MmsClientInternalParameter intParam; @@ -4415,15 +4453,13 @@ MmsConnection_writeMultipleVariablesAsync(MmsConnection self, MmsError* mmsError } else { *mmsError = MMS_ERROR_RESOURCE_OTHER; - return 0; } exit_function: - return invokeId; + return; } - MmsDataAccessError MmsConnection_writeArrayElements(MmsConnection self, MmsError* mmsError, const char* domainId, const char* itemId, int index, int numberOfElements, @@ -4439,7 +4475,7 @@ MmsConnection_writeArrayElements(MmsConnection self, MmsError* mmsError, Semaphore_wait(parameter.waitForResponse); - MmsConnection_writeArrayElementsAsync(self, &err, domainId, itemId, index, numberOfElements, value, writeVariableHandler, ¶meter); + MmsConnection_writeArrayElementsAsync(self, NULL, &err, domainId, itemId, index, numberOfElements, value, writeVariableHandler, ¶meter); if (err == MMS_ERROR_NONE) { Semaphore_wait(parameter.waitForResponse); @@ -4455,14 +4491,12 @@ MmsConnection_writeArrayElements(MmsConnection self, MmsError* mmsError, return parameter.accessError; } -uint32_t -MmsConnection_writeArrayElementsAsync(MmsConnection self, MmsError* mmsError, +void +MmsConnection_writeArrayElementsAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, const char* domainId, const char* itemId, int index, int numberOfElements, MmsValue* value, MmsConnection_WriteVariableHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -4471,7 +4505,10 @@ MmsConnection_writeArrayElementsAsync(MmsConnection self, MmsError* mmsError, ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createWriteRequestArray(invokeId, domainId, itemId, index, numberOfElements, value, payload); @@ -4484,7 +4521,7 @@ MmsConnection_writeArrayElementsAsync(MmsConnection self, MmsError* mmsError, *mmsError = err; exit_function: - return invokeId; + return; } void @@ -4502,7 +4539,7 @@ MmsConnection_writeNamedVariableList(MmsConnection self, MmsError* mmsError, boo Semaphore_wait(parameter.sem); - MmsConnection_writeNamedVariableListAsync(self, &err, isAssociationSpecific, domainId, itemId, values, writeMultipleVariablesHandler, ¶meter); + MmsConnection_writeNamedVariableListAsync(self, NULL, &err, isAssociationSpecific, domainId, itemId, values, writeMultipleVariablesHandler, ¶meter); if (err == MMS_ERROR_NONE) { @@ -4526,13 +4563,11 @@ MmsConnection_writeNamedVariableList(MmsConnection self, MmsError* mmsError, boo Semaphore_destroy(parameter.sem); } -uint32_t -MmsConnection_writeNamedVariableListAsync(MmsConnection self, MmsError* mmsError, bool isAssociationSpecific, +void +MmsConnection_writeNamedVariableListAsync(MmsConnection self, uint32_t* usedInvokeId, MmsError* mmsError, bool isAssociationSpecific, const char* domainId, const char* itemId, LinkedList /* */values, MmsConnection_WriteMultipleVariablesHandler handler, void* parameter) { - uint32_t invokeId = 0; - if (getConnectionState(self) != MMS_CONNECTION_STATE_CONNECTED) { if (mmsError) *mmsError = MMS_ERROR_CONNECTION_LOST; @@ -4541,7 +4576,10 @@ MmsConnection_writeNamedVariableListAsync(MmsConnection self, MmsError* mmsError ByteBuffer* payload = IsoClientConnection_allocateTransmitBuffer(self->isoClient); - invokeId = getNextInvokeId(self); + uint32_t invokeId = getNextInvokeId(self); + + if (usedInvokeId) + *usedInvokeId = invokeId; mmsClient_createWriteRequestNamedVariableList(invokeId, isAssociationSpecific, domainId, itemId, values, payload); @@ -4554,7 +4592,7 @@ MmsConnection_writeNamedVariableListAsync(MmsConnection self, MmsError* mmsError *mmsError = err; exit_function: - return invokeId; + return; } void