- added functions Timestamp_fromMmsValue and Quality_toMmsValue

pull/374/head
Michael Zillgith 4 years ago
parent b27681f408
commit b374644d30

@ -1,7 +1,7 @@
/*
* iec61850_common.c
*
* Copyright 2013-2020 Michael Zillgith
* Copyright 2013-2022 Michael Zillgith
*
* This file is part of libIEC61850.
*
@ -70,6 +70,20 @@ Quality_fromMmsValue(const MmsValue* mmsValue)
return (Quality) MmsValue_getBitStringAsInteger(mmsValue);
}
MmsValue*
Quality_toMmsValue(Quality* self, MmsValue* mmsValue)
{
if (mmsValue == NULL) {
mmsValue = MmsValue_newBitString(13);
}
if (mmsValue) {
MmsValue_setBitStringFromInteger(mmsValue, *self);
}
return mmsValue;
}
Dbpos
Dbpos_fromMmsValue(const MmsValue* mmsValue)
{
@ -491,6 +505,25 @@ Timestamp_toMmsValue(Timestamp* self, MmsValue* mmsValue)
return convertedValue;
}
Timestamp*
Timestamp_fromMmsValue(Timestamp* self, MmsValue* mmsValue)
{
if (mmsValue->type == MMS_UTC_TIME) {
if (self == NULL)
self = Timestamp_create();
if (self) {
memcpy(self->val, mmsValue->value.utcTime, 8);
}
return self;
}
else {
return NULL;
}
}
char*
MmsMapping_getMmsDomainFromObjectReference(const char* objectReference, char* buffer)
{

@ -370,6 +370,9 @@ Quality_isFlagSet(Quality* self, int flag);
LIB61850_API Quality
Quality_fromMmsValue(const MmsValue* mmsValue);
LIB61850_API MmsValue*
Quality_toMmsValue(Quality* self, MmsValue* mmsValue);
/** @} */
/**
@ -515,6 +518,17 @@ Timestamp_setByMmsUtcTime(Timestamp* self, const MmsValue* mmsValue);
LIB61850_API MmsValue*
Timestamp_toMmsValue(Timestamp* self, MmsValue* mmsValue);
/**
* \brief Get the Timestamp value from an MmsValue instance of type MMS_UTC_TIME
*
* \param self the Timestamp instance or NULL to create a new instance
* \param mmsValue the mmsValue instance of type MMS_UTC_TIME
*
* \return the updated Timestamp value or NULL in case of an error
*/
LIB61850_API Timestamp*
Timestamp_fromMmsValue(Timestamp* self, MmsValue* mmsValue);
/**
* \brief Get the version of the library as string
*

Loading…
Cancel
Save