refactor "SVClientASDU" to "SVSubscriber_ASDU"

pull/35/head
Steffen Vogel 8 years ago
parent b4b69bf56d
commit 12cf073f81

@ -67,7 +67,7 @@ struct sSVSubscriber {
void* listenerParameter;
};
struct sSVClientASDU {
struct sSVSubscriber_ASDU {
char* svId;
@ -235,8 +235,8 @@ parseASDU(SVReceiver self, SVSubscriber subscriber, uint8_t* buffer, int length)
{
int bufPos = 0;
struct sSVClientASDU asdu;
memset(&asdu, 0, sizeof(struct sSVClientASDU));
struct sSVSubscriber_ASDU asdu;
memset(&asdu, 0, sizeof(struct sSVSubscriber_ASDU));
int svIdLength = 0;
@ -519,7 +519,7 @@ SVSubscriber_setListener(SVSubscriber self, SVUpdateListener listener, void* pa
}
uint16_t
SVClientASDU_getSmpCnt(SVClientASDU self)
SVSubscriber_ASDU_getSmpCnt(SVSubscriber_ASDU self)
{
uint16_t retVal;
uint8_t* valBytes = (uint8_t*) &retVal;
@ -564,7 +564,7 @@ decodeUtcTime(uint8_t* buffer, uint8_t* timeQuality)
}
uint64_t
SVClientASDU_getRefrTmAsMs(SVClientASDU self)
SVSubscriber_ASDU_getRefrTmAsMs(SVSubscriber_ASDU self)
{
uint64_t msTime = 0;
@ -575,20 +575,20 @@ SVClientASDU_getRefrTmAsMs(SVClientASDU self)
}
bool
SVClientASDU_hasRefrTm(SVClientASDU self)
SVSubscriber_ASDU_hasRefrTm(SVSubscriber_ASDU self)
{
return (self->refrTm != NULL);
}
const char*
SVClientASDU_getSvId(SVClientASDU self)
SVSubscriber_ASDU_getSvId(SVSubscriber_ASDU self)
{
return self->svId;
}
uint32_t
SVClientASDU_getConfRev(SVClientASDU self)
SVSubscriber_ASDU_getConfRev(SVSubscriber_ASDU self)
{
uint32_t retVal = *((uint32_t*) (self->confRev));
@ -602,7 +602,7 @@ SVClientASDU_getConfRev(SVClientASDU self)
}
int8_t
SVClientASDU_getINT8(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT8(SVSubscriber_ASDU self, int index)
{
int8_t retVal = *((int8_t*) (self->dataBuffer + index));
@ -610,7 +610,7 @@ SVClientASDU_getINT8(SVClientASDU self, int index)
}
int16_t
SVClientASDU_getINT16(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT16(SVSubscriber_ASDU self, int index)
{
int16_t retVal = *((int16_t*) (self->dataBuffer + index));
@ -624,7 +624,7 @@ SVClientASDU_getINT16(SVClientASDU self, int index)
}
int32_t
SVClientASDU_getINT32(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT32(SVSubscriber_ASDU self, int index)
{
int32_t retVal = *((int32_t*) (self->dataBuffer + index));
@ -638,7 +638,7 @@ SVClientASDU_getINT32(SVClientASDU self, int index)
}
int64_t
SVClientASDU_getINT64(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT64(SVSubscriber_ASDU self, int index)
{
int64_t retVal = *((int64_t*) (self->dataBuffer + index));
@ -652,7 +652,7 @@ SVClientASDU_getINT64(SVClientASDU self, int index)
}
uint8_t
SVClientASDU_getINT8U(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT8U(SVSubscriber_ASDU self, int index)
{
uint8_t retVal = *((uint8_t*) (self->dataBuffer + index));
@ -660,7 +660,7 @@ SVClientASDU_getINT8U(SVClientASDU self, int index)
}
uint16_t
SVClientASDU_getINT16U(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT16U(SVSubscriber_ASDU self, int index)
{
uint16_t retVal = *((uint16_t*) (self->dataBuffer + index));
@ -674,7 +674,7 @@ SVClientASDU_getINT16U(SVClientASDU self, int index)
}
uint32_t
SVClientASDU_getINT32U(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT32U(SVSubscriber_ASDU self, int index)
{
uint32_t retVal = *((uint32_t*) (self->dataBuffer + index));
@ -688,7 +688,7 @@ SVClientASDU_getINT32U(SVClientASDU self, int index)
}
uint64_t
SVClientASDU_getINT64U(SVClientASDU self, int index)
SVSubscriber_ASDU_getINT64U(SVSubscriber_ASDU self, int index)
{
uint64_t retVal = *((uint64_t*) (self->dataBuffer + index));
@ -702,7 +702,7 @@ SVClientASDU_getINT64U(SVClientASDU self, int index)
}
float
SVClientASDU_getFLOAT32(SVClientASDU self, int index)
SVSubscriber_ASDU_getFLOAT32(SVSubscriber_ASDU self, int index)
{
float retVal = *((float*) (self->dataBuffer + index));
@ -716,7 +716,7 @@ SVClientASDU_getFLOAT32(SVClientASDU self, int index)
}
double
SVClientASDU_getFLOAT64(SVClientASDU self, int index)
SVSubscriber_ASDU_getFLOAT64(SVSubscriber_ASDU self, int index)
{
double retVal = *((double*) (self->dataBuffer + index));
@ -731,7 +731,7 @@ SVClientASDU_getFLOAT64(SVClientASDU self, int index)
int
SVClientASDU_getDataSize(SVClientASDU self)
SVSubscriber_ASDU_getDataSize(SVSubscriber_ASDU self)
{
return self->dataBufferLength;
}

@ -40,15 +40,15 @@ extern "C" {
* An \ref SVSubscriber object is associated to a SV data stream that is identified by its appID
* and destination Ethernet address. The \reg SVSubscriber object is used to install a callback
* handler \ref SVUpdateListener that is invoked for each ASDU (application service data unit) received for the
* associated stream. An \ref SVClientASDU is an object that represents a single ASDU. Each ASDU contains
* associated stream. An \ref SVSubscriber_ASDU is an object that represents a single ASDU. Each ASDU contains
* some meta information that can be obtained by specific access functions like e.g.
* \ref SVClientASDU_getSmpCnt to access the "SmpCnt" (sample count) attribute of the ASDU. The actual
* \ref SVSubscriber_ASDU_getSmpCnt to access the "SmpCnt" (sample count) attribute of the ASDU. The actual
* measurement data contained in the ASDU does not consist of structured ASN.1 data but stored as raw binary
* data. Without a priori knowledge of the dataset associated with the ASDU data stream it is not
* possible to interpret the received data correctly. Therefore you have to provide the data access functions
* with an index value to indicate the data type and the start of the data in the data block of the ASDU.
* E.g. reading a data set consisting of two FLOAT32 values you can use two subsequent calls of
* \ref SVClientASDU_getFLOAT32 one with index = 0 and the second one with index = 4.
* \ref SVSubscriber_ASDU_getFLOAT32 one with index = 0 and the second one with index = 4.
*
* | IEC 61850 type | required bytes |
* | -------------- | -------------- |
@ -86,18 +86,18 @@ extern "C" {
* sampled value data. Each ASDU represents a single sample consisting of multiple measurement
* values with a single dedicated timestamp.
*
* NOTE: SVClientASDU are statically allocated and are only valid inside of the SVUpdateListener
* NOTE: SVSubscriber_ASDU are statically allocated and are only valid inside of the SVUpdateListener
* function when called by the library. If you need the data contained in the ASDU elsewhere
* you have to copy and store the data by yourself!
*/
typedef struct sSVClientASDU* SVClientASDU;
typedef struct sSVSubscriber_ASDU* SVSubscriber_ASDU;
/**
* \brief opaque handle to a SV subscriber instance
*
* A subscriber is an instance associated with a single stream of measurement data. It is identified
* by the Ethernet destination address, the appID value (both are on SV message level) and the svID value
* that is part of each ASDU (SVClientASDU object).
* that is part of each ASDU (SVSubscriber_ASDU object).
*/
typedef struct sSVSubscriber* SVSubscriber;
@ -110,7 +110,7 @@ typedef struct sSVSubscriber* SVSubscriber;
* \param parameter a user provided parameter that is simply passed to the callback
* \param asdu SV ASDU data structure. This structure is only valid inside of the callback function
*/
typedef void (*SVUpdateListener)(SVSubscriber subscriber, void* parameter, SVClientASDU asdu);
typedef void (*SVUpdateListener)(SVSubscriber subscriber, void* parameter, SVSubscriber_ASDU asdu);
/**
* \brief opaque handle to a SV receiver instance
@ -239,7 +239,7 @@ void
SVSubscriber_destroy(SVSubscriber self);
/*************************************************************************
* SVClientASDU object methods
* SVSubscriber_ASDU object methods
**************************************************************************/
/**
@ -256,7 +256,7 @@ SVSubscriber_destroy(SVSubscriber self);
* \param self ASDU object instance
*/
uint16_t
SVClientASDU_getSmpCnt(SVClientASDU self);
SVSubscriber_ASDU_getSmpCnt(SVSubscriber_ASDU self);
/**
* \brief return the SvID value included in the SV ASDU
@ -264,7 +264,7 @@ SVClientASDU_getSmpCnt(SVClientASDU self);
* \param self ASDU object instance
*/
const char*
SVClientASDU_getSvId(SVClientASDU self);
SVSubscriber_ASDU_getSvId(SVSubscriber_ASDU self);
/**
* \brief return the ConfRev value included in the SV ASDU
@ -272,7 +272,7 @@ SVClientASDU_getSvId(SVClientASDU self);
* \param self ASDU object instance
*/
uint32_t
SVClientASDU_getConfRev(SVClientASDU self);
SVSubscriber_ASDU_getConfRev(SVSubscriber_ASDU self);
/**
* \brief Check if RefrTm value is included in the SV ASDU
@ -282,7 +282,7 @@ SVClientASDU_getConfRev(SVClientASDU self);
* \return true if RefrTm value is present, false otherwise
*/
bool
SVClientASDU_hasRefrTm(SVClientASDU self);
SVSubscriber_ASDU_hasRefrTm(SVSubscriber_ASDU self);
/**
* \brief Get the RefrTim value included in SV ASDU as ms timestamp
@ -292,7 +292,7 @@ SVClientASDU_hasRefrTm(SVClientASDU self);
* \return the time value as ms timestamp or 0 if RefrTm is not present in the SV ASDU
*/
uint64_t
SVClientASDU_getRefrTmAsMs(SVClientASDU self);
SVSubscriber_ASDU_getRefrTmAsMs(SVSubscriber_ASDU self);
/**
* \brief Get an INT8 data value in the data part of the ASDU
@ -303,7 +303,7 @@ SVClientASDU_getRefrTmAsMs(SVClientASDU self);
* \return SV data
*/
int8_t
SVClientASDU_getINT8(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT8(SVSubscriber_ASDU self, int index);
/**
* \brief Get an INT16 data value in the data part of the ASDU
@ -314,7 +314,7 @@ SVClientASDU_getINT8(SVClientASDU self, int index);
* \return SV data
*/
int16_t
SVClientASDU_getINT16(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT16(SVSubscriber_ASDU self, int index);
/**
* \brief Get an INT32 data value in the data part of the ASDU
@ -325,7 +325,7 @@ SVClientASDU_getINT16(SVClientASDU self, int index);
* \return SV data
*/
int32_t
SVClientASDU_getINT32(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT32(SVSubscriber_ASDU self, int index);
/**
* \brief Get an INT64 data value in the data part of the ASDU
@ -336,7 +336,7 @@ SVClientASDU_getINT32(SVClientASDU self, int index);
* \return SV data
*/
int64_t
SVClientASDU_getINT64(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT64(SVSubscriber_ASDU self, int index);
/**
* \brief Get an INT8U data value in the data part of the ASDU
@ -347,7 +347,7 @@ SVClientASDU_getINT64(SVClientASDU self, int index);
* \return SV data
*/
uint8_t
SVClientASDU_getINT8U(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT8U(SVSubscriber_ASDU self, int index);
/**
* \brief Get an INT16U data value in the data part of the ASDU
@ -358,7 +358,7 @@ SVClientASDU_getINT8U(SVClientASDU self, int index);
* \return SV data
*/
uint16_t
SVClientASDU_getINT16U(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT16U(SVSubscriber_ASDU self, int index);
/**
* \brief Get an INT32U data value in the data part of the ASDU
@ -369,7 +369,7 @@ SVClientASDU_getINT16U(SVClientASDU self, int index);
* \return SV data
*/
uint32_t
SVClientASDU_getINT32U(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT32U(SVSubscriber_ASDU self, int index);
/**
* \brief Get an INT64U data value in the data part of the ASDU
@ -380,7 +380,7 @@ SVClientASDU_getINT32U(SVClientASDU self, int index);
* \return SV data
*/
uint64_t
SVClientASDU_getINT64U(SVClientASDU self, int index);
SVSubscriber_ASDU_getINT64U(SVSubscriber_ASDU self, int index);
/**
* \brief Get an FLOAT32 data value in the data part of the ASDU
@ -391,7 +391,7 @@ SVClientASDU_getINT64U(SVClientASDU self, int index);
* \return SV data
*/
float
SVClientASDU_getFLOAT32(SVClientASDU self, int index);
SVSubscriber_ASDU_getFLOAT32(SVSubscriber_ASDU self, int index);
/**
* \brief Get an FLOAT64 data value in the data part of the ASDU
@ -402,7 +402,7 @@ SVClientASDU_getFLOAT32(SVClientASDU self, int index);
* \return SV data
*/
double
SVClientASDU_getFLOAT64(SVClientASDU self, int index);
SVSubscriber_ASDU_getFLOAT64(SVSubscriber_ASDU self, int index);
/**
* \brief Returns the size of the data part of the ASDU
@ -412,7 +412,7 @@ SVClientASDU_getFLOAT64(SVClientASDU self, int index);
* \return size of the ASDU data part in bytes.
*/
int
SVClientASDU_getDataSize(SVClientASDU self);
SVSubscriber_ASDU_getDataSize(SVSubscriber_ASDU self);
/**@} @}*/
@ -420,5 +420,6 @@ SVClientASDU_getDataSize(SVClientASDU self);
}
#endif
#include "sv_subscriber_deprecated.h"
#endif /* SAMPLED_VALUES_SV_SUBSCRIBER_ */

Loading…
Cancel
Save