MCPcopy Create free account
hub / github.com/EIPStackGroup/OpENer / HandleReceivedIoConnectionData

Function HandleReceivedIoConnectionData

source/src/cip/cipioconnection.c:870–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868}
869
870EipStatus HandleReceivedIoConnectionData(
871 CipConnectionObject *connection_object,
872 const EipUint8 *data,
873 EipUint16 data_length
874 ) {
875
876 OPENER_TRACE_INFO("Starting data length: %d\n", data_length);
877 bool no_new_data = false;
878 /* check class 1 sequence number*/
879 if (kConnectionObjectTransportClassTriggerTransportClass1 ==
880 ConnectionObjectGetTransportClassTriggerTransportClass(connection_object) )
881 {
882 EipUint16 sequence_buffer = GetIntFromMessage( &(data) );
883 if ( SEQ_LEQ16(sequence_buffer,
884 connection_object->sequence_count_consuming) ) {
885 no_new_data = true;
886 }
887 connection_object->sequence_count_consuming = sequence_buffer;
888 data_length -= 2;
889 }
890
891 OPENER_TRACE_INFO("data length after sequence count: %d\n", data_length);
892 if (data_length > 0) {
893 /* we have no heartbeat connection */
894#ifdef OPENER_CONSUMED_DATA_HAS_RUN_IDLE_HEADER
895 EipUint32 nRunIdleBuf = GetDintFromMessage( &(data) );
896 OPENER_TRACE_INFO("Run/Idle handler: 0x%x", nRunIdleBuf);
897 const uint32_t kRunBitMask = 0x0001;
898 if( (kRunBitMask & nRunIdleBuf) == 1 ) {
899 CipIdentitySetExtendedDeviceStatus(kAtLeastOneIoConnectionInRunMode);
900 } else {
901 CipIdentitySetExtendedDeviceStatus(
902 kAtLeastOneIoConnectionEstablishedAllInIdleMode);
903 }
904 if (g_run_idle_state != nRunIdleBuf) {
905 RunIdleChanged(nRunIdleBuf);
906 }
907 g_run_idle_state = nRunIdleBuf;
908 data_length -= 4;
909#endif /* OPENER_CONSUMED_DATA_HAS_RUN_IDLE_HEADER */
910 if(no_new_data) {
911 return kEipStatusOk;
912 }
913
914 if (NotifyAssemblyConnectedDataReceived(
915 connection_object->consuming_instance, (EipUint8 *const)data,
916 data_length) != 0) {
917 return kEipStatusError;
918 }
919 }
920 return kEipStatusOk;
921}
922
923EipStatus OpenCommunicationChannels(CipConnectionObject *connection_object) {
924

Callers

nothing calls this directly

Tested by

no test coverage detected