OpENer - Open Source EtherNet/IP(TM) I/O Target Stack  2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cipassembly.c File Reference
#include <string.h>
#include <stdbool.h>
#include "cipassembly.h"
#include "cipcommon.h"
#include "opener_api.h"
#include "trace.h"
#include "cipconnectionmanager.h"
Include dependency graph for cipassembly.c:

Go to the source code of this file.

Functions

EipStatus CipAssemblyInitialize (void)
 create the CIP Assembly object with zero instances More...
 
CipClassCreateAssemblyClass (void)
 Constructor for the assembly object class. More...
 
CipInstanceCreateAssemblyObject (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...
 

Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

CipClass* CreateAssemblyClass ( void  )

Constructor for the assembly object class.

Creates an initializes Assembly class or object instances

Returns
Pointer to the created Assembly object

Definition at line 32 of file cipassembly.c.

References CreateCipClass(), GetAttributeSingle(), InsertService(), kGetAttributeSingle, kSetAttributeSingle, and SetAssemblyAttributeSingle().

Referenced by CipAssemblyInitialize(), and CreateAssemblyObject().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
instancethe assembly object instance for which the data was received
datapointer to the data received
data_lengthnumber of bytes received
Returns
  • kEipStatusOk the received data was okay
  • kEipStatusError the received data was wrong

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function: