From 603f343d5d5d5329ba9e0876be13481c92b4116e Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Mon, 16 Nov 2015 12:25:33 +0100 Subject: [PATCH] - removed type DstAddress and replaced by type PhyComAddress --- .../iec61850_sv_client_example/sv_client_example.c | 10 +++++----- src/iec61850/client/client_sv_control.c | 10 +++++----- src/iec61850/inc/iec61850_client.h | 9 +-------- src/iec61850/inc/iec61850_common.h | 8 ++++++++ src/iec61850/inc/iec61850_model.h | 7 ------- src/sampled_values/sv_subscriber.h | 2 +- 6 files changed, 20 insertions(+), 26 deletions(-) diff --git a/examples/iec61850_sv_client_example/sv_client_example.c b/examples/iec61850_sv_client_example/sv_client_example.c index 1ffe8ae..90922ec 100644 --- a/examples/iec61850_sv_client_example/sv_client_example.c +++ b/examples/iec61850_sv_client_example/sv_client_example.c @@ -12,16 +12,16 @@ #include "hal_thread.h" static void -printDstAddr(DstAddress dstAddress) +printDstAddr(PhyComAddress dstAddress) { printf(" addr: "); int i; for (i = 0; i < 6; i++) - printf("%02x", dstAddress.addr[i]); + printf("%02x", dstAddress.dstAddress[i]); - printf("\n prio: %u\n", dstAddress.priority); - printf(" vid: %u\n", dstAddress.vid); + printf("\n prio: %u\n", dstAddress.vlanPriority); + printf(" vid: %u\n", dstAddress.vlanId); printf(" appID: %u\n", dstAddress.appId); } @@ -98,7 +98,7 @@ int main(int argc, char** argv) { printf("noASDU: %i\n", ClientSVControlBlock_getNoASDU(svcb)); - DstAddress dstAddress = ClientSVControlBlock_getDstAddress(svcb); + PhyComAddress dstAddress = ClientSVControlBlock_getDstAddress(svcb); printDstAddr(dstAddress); diff --git a/src/iec61850/client/client_sv_control.c b/src/iec61850/client/client_sv_control.c index 6a2cfb6..966ea63 100644 --- a/src/iec61850/client/client_sv_control.c +++ b/src/iec61850/client/client_sv_control.c @@ -271,7 +271,7 @@ ClientSVControlBlock_getNoASDU(ClientSVControlBlock self) return readUIntVariable(self, "noASDU"); } -DstAddress +PhyComAddress ClientSVControlBlock_getDstAddress(ClientSVControlBlock self) { char refBuf[130]; @@ -289,7 +289,7 @@ ClientSVControlBlock_getDstAddress(ClientSVControlBlock self) else dstAddrValue = IedConnection_readObject(self->connection, &(self->lastError), refBuf, IEC61850_FC_US); - DstAddress retVal; + PhyComAddress retVal; memset(&retVal, 0, sizeof(retVal)); if (dstAddrValue == NULL) goto exit_error; @@ -318,7 +318,7 @@ ClientSVControlBlock_getDstAddress(ClientSVControlBlock self) uint8_t* addrBuf = MmsValue_getOctetStringBuffer(addr); - memcpy(&(retVal.addr), addrBuf, 6); + memcpy(&(retVal.dstAddress), addrBuf, 6); MmsValue* prio = MmsValue_getElement(dstAddrValue, 1); @@ -327,7 +327,7 @@ ClientSVControlBlock_getDstAddress(ClientSVControlBlock self) goto exit_cleanup; } - retVal.priority = MmsValue_toUint32(prio); + retVal.vlanPriority = MmsValue_toUint32(prio); MmsValue* vid = MmsValue_getElement(dstAddrValue, 2); @@ -336,7 +336,7 @@ ClientSVControlBlock_getDstAddress(ClientSVControlBlock self) goto exit_cleanup; } - retVal.vid = MmsValue_toUint32(vid); + retVal.vlanId = MmsValue_toUint32(vid); MmsValue* appID = MmsValue_getElement(dstAddrValue, 3); diff --git a/src/iec61850/inc/iec61850_client.h b/src/iec61850/inc/iec61850_client.h index 69dce0f..2f7b1b8 100644 --- a/src/iec61850/inc/iec61850_client.h +++ b/src/iec61850/inc/iec61850_client.h @@ -331,13 +331,6 @@ IedConnection_getMmsConnection(IedConnection self); /** an opaque handle to the instance data of a ClientSVControlBlock object */ typedef struct sClientSVControlBlock* ClientSVControlBlock; -typedef struct { - uint8_t addr[6]; - uint8_t priority; - uint16_t vid; - uint16_t appId; -} DstAddress; - /** * \brief Create a new ClientSVControlBlock instance * @@ -415,7 +408,7 @@ ClientSVControlBlock_getSmpRate(ClientSVControlBlock self); * * \param self the ClientSVControlBlock instance to operate on */ -DstAddress +PhyComAddress ClientSVControlBlock_getDstAddress(ClientSVControlBlock self); /** diff --git a/src/iec61850/inc/iec61850_common.h b/src/iec61850/inc/iec61850_common.h index 0ff9189..0c9dc27 100644 --- a/src/iec61850/inc/iec61850_common.h +++ b/src/iec61850/inc/iec61850_common.h @@ -36,6 +36,14 @@ extern "C" { */ /**@{*/ +/** PhyComAddress type contains Ethernet address and VLAN attributes */ +typedef struct { + uint8_t vlanPriority; + uint16_t vlanId; + uint16_t appId; + uint8_t dstAddress[6]; +} PhyComAddress; + /** * @defgroup TRIGGER_OPTIONS Trigger options (bit values combinable) * diff --git a/src/iec61850/inc/iec61850_model.h b/src/iec61850/inc/iec61850_model.h index 376593b..cd6828b 100644 --- a/src/iec61850/inc/iec61850_model.h +++ b/src/iec61850/inc/iec61850_model.h @@ -270,13 +270,6 @@ struct sSettingGroupControlBlock { SettingGroupControlBlock* sibling; /* next control block in list or NULL if this is the last entry */ }; -typedef struct { - uint8_t vlanPriority; - uint16_t vlanId; - uint16_t appId; - uint8_t dstAddress[6]; -} PhyComAddress; - struct sGSEControlBlock { LogicalNode* parent; char* name; diff --git a/src/sampled_values/sv_subscriber.h b/src/sampled_values/sv_subscriber.h index 282eb3f..c463e5b 100644 --- a/src/sampled_values/sv_subscriber.h +++ b/src/sampled_values/sv_subscriber.h @@ -39,7 +39,7 @@ extern "C" { * Ethernet interfaces you have to use several \ref SVReceiver instances. * 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 that is invoked for each ASDU (application service data unit) received for the + * 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 * 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