OpENer - Open Source EtherNet/IP(TM) I/O Target Stack
2.1
|
#include <string.h>
#include <stdbool.h>
#include "cipassembly.h"
#include "cipcommon.h"
#include "opener_api.h"
#include "trace.h"
#include "cipconnectionmanager.h"
Go to the source code of this file.
Functions | |
EipStatus | CipAssemblyInitialize (void) |
create the CIP Assembly object with zero instances More... | |
CipClass * | CreateAssemblyClass (void) |
Constructor for the assembly object class. More... | |
CipInstance * | CreateAssemblyObject (const EipUint32 instance_id, EipByte *const data, const EipUint16 data_length) |
Create an instance of an assembly object. More... | |
EipStatus | NotifyAssemblyConnectedDataReceived (CipInstance *const instance, const EipUint8 *const data, const EipUint16 data_length) |
notify an Assembly object that data has been received for it. More... | |
EipStatus | SetAssemblyAttributeSingle (CipInstance *const instance, CipMessageRouterRequest *const message_router_request, CipMessageRouterResponse *const message_router_response, struct sockaddr *originator_address, const int encapsulation_session) |
Implementation of the SetAttributeSingle CIP service for Assembly Objects. Currently only supports Attribute 3 (CIP_BYTE_ARRAY) of an Assembly. More... | |
void | ShutdownAssemblies (void) |
clean up the data allocated in the assembly object instances More... | |
EipStatus CipAssemblyInitialize | ( | void | ) |
create the CIP Assembly object with zero instances
Setup the Assembly object.
Definition at line 61 of file cipassembly.c.
References CreateAssemblyClass(), kEipStatusError, and kEipStatusOk.
Referenced by CipStackInit().
CipClass* CreateAssemblyClass | ( | void | ) |
Constructor for the assembly object class.
Creates an initializes Assembly class or object instances
Definition at line 32 of file cipassembly.c.
References CreateCipClass(), GetAttributeSingle(), InsertService(), kGetAttributeSingle, kSetAttributeSingle, and SetAssemblyAttributeSingle().
Referenced by CipAssemblyInitialize(), and CreateAssemblyObject().
EipStatus NotifyAssemblyConnectedDataReceived | ( | CipInstance *const | instance, |
const EipUint8 *const | data, | ||
const EipUint16 | data_length | ||
) |
notify an Assembly object that data has been received for it.
The data will be copied into the assembly objects attribute 3 and the application will be informed with the AfterAssemblyDataReceived function.
instance | the assembly object instance for which the data was received |
data | pointer to the data received |
data_length | number of bytes received |
Definition at line 118 of file cipassembly.c.
References AfterAssemblyDataReceived(), cip_instance::attributes, CipByteArray::data, CipAttributeStruct::data, kEipStatusError, CipByteArray::length, and OPENER_TRACE_ERR.
Referenced by HandleConfigData(), and HandleReceivedIoConnectionData().
EipStatus SetAssemblyAttributeSingle | ( | CipInstance *const | instance, |
CipMessageRouterRequest *const | message_router_request, | ||
CipMessageRouterResponse *const | message_router_response, | ||
struct sockaddr * | originator_address, | ||
const int | encapsulation_session | ||
) |
Implementation of the SetAttributeSingle CIP service for Assembly Objects. Currently only supports Attribute 3 (CIP_BYTE_ARRAY) of an Assembly.
Definition at line 137 of file cipassembly.c.
References AfterAssemblyDataReceived(), CipEpath::attribute_number, CipByteArray::data, CipMessageRouterRequest::data, CipAttributeStruct::data, CipMessageRouterResponse::data_length, CipMessageRouterResponse::general_status, GetCipAttribute(), cip_instance::instance_number, IsConnectedOutputAssembly(), kCipErrorAttributeNotSetable, kCipErrorAttributeNotSupported, kCipErrorInvalidAttributeValue, kCipErrorNotEnoughData, kCipErrorSuccess, kCipErrorTooMuchData, kEipStatusOk, kEipStatusOkSend, CipByteArray::length, OPENER_TRACE_INFO, OPENER_TRACE_WARN, CipMessageRouterResponse::reply_service, CipMessageRouterRequest::request_path, CipMessageRouterRequest::request_path_size, CipMessageRouterRequest::service, and CipMessageRouterResponse::size_of_additional_status.
Referenced by CreateAssemblyClass().
void ShutdownAssemblies | ( | void | ) |
clean up the data allocated in the assembly object instances
Assembly object instances allocate per instance data to store attribute 3. This will be freed here. The assembly object data given by the application is not freed neither the assembly object instances. These are handled in the main shutdown function.
Definition at line 65 of file cipassembly.c.
References CipFree(), CipAttributeStruct::data, GetCipAttribute(), GetCipClass(), cip_class::instances, and cip_instance::next.
Referenced by ShutdownCipStack().