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

Function GetPathLogicalSegmentLogicalType

source/src/cip/cipepath.c:213–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211/*** Logical Segment ***/
212
213LogicalSegmentLogicalType GetPathLogicalSegmentLogicalType(
214 const unsigned char *const cip_path) {
215 OPENER_ASSERT( kSegmentTypeLogicalSegment == GetPathSegmentType(cip_path) )
216 const unsigned int kLogicalTypeMask = 0x1C;
217 const unsigned int logical_type = (*cip_path) & kLogicalTypeMask;
218 LogicalSegmentLogicalType result = kLogicalSegmentLogicalTypeExtendedLogical;
219 switch (logical_type) {
220 case LOGICAL_SEGMENT_TYPE_CLASS_ID:
221 result = kLogicalSegmentLogicalTypeClassId;
222 break;
223 case LOGICAL_SEGMENT_TYPE_INSTANCE_ID:
224 result = kLogicalSegmentLogicalTypeInstanceId;
225 break;
226 case LOGICAL_SEGMENT_TYPE_MEMBER_ID:
227 result = kLogicalSegmentLogicalTypeMemberId;
228 break;
229 case LOGICAL_SEGMENT_TYPE_CONNECTION_POINT:
230 result = kLogicalSegmentLogicalTypeConnectionPoint;
231 break;
232 case LOGICAL_SEGMENT_TYPE_ATTRIBUTE_ID:
233 result = kLogicalSegmentLogicalTypeAttributeId;
234 break;
235 case LOGICAL_SEGMENT_TYPE_SPECIAL:
236 result = kLogicalSegmentLogicalTypeSpecial;
237 break;
238 case LOGICAL_SEGMENT_TYPE_SERVICE_ID:
239 result = kLogicalSegmentLogicalTypeServiceId;
240 break;
241 case LOGICAL_SEGMENT_TYPE_EXTENDED_LOGICAL:
242 result = kLogicalSegmentLogicalTypeExtendedLogical;
243 break;
244 default:
245 OPENER_ASSERT(
246 "Logical segment/logical type: It is not possible to reach this point!\n")
247 break;
248 }
249 return result;
250}
251
252void SetPathLogicalSegmentLogicalType(LogicalSegmentLogicalType logical_type,
253 CipOctet *const cip_path) {

Callers 4

ParseConnectionPathFunction · 0.85
TESTFunction · 0.85

Calls 1

GetPathSegmentTypeFunction · 0.85

Tested by 1

TESTFunction · 0.68