| 39 | } |
| 40 | |
| 41 | EipStatus SetAttributeSingleQoS( |
| 42 | CipInstance *instance, |
| 43 | CipMessageRouterRequest *message_router_request, |
| 44 | CipMessageRouterResponse *message_router_response, |
| 45 | struct sockaddr *originator_address, |
| 46 | const int encapsulation_session) { |
| 47 | |
| 48 | CipAttributeStruct *attribute = GetCipAttribute( |
| 49 | instance, message_router_request->request_path.attribute_number); |
| 50 | (void) instance; /*Suppress compiler warning */ |
| 51 | EipUint16 attribute_number = |
| 52 | message_router_request->request_path.attribute_number; |
| 53 | uint8_t set_bit_mask = (instance->cip_class->set_bit_mask[CalculateIndex( |
| 54 | attribute_number) |
| 55 | ]); |
| 56 | |
| 57 | if( NULL != attribute && |
| 58 | ( set_bit_mask & ( 1 << ( (attribute_number) % 8 ) ) ) ) { |
| 59 | CipUint attribute_value_recieved = GetDintFromMessage( |
| 60 | &(message_router_request->data) ); |
| 61 | |
| 62 | if( !( (attribute_value_recieved <= 0) || |
| 63 | (attribute_value_recieved >= 63) ) ) { |
| 64 | OPENER_TRACE_INFO(" setAttribute %d\n", attribute_number); |
| 65 | |
| 66 | if(NULL != attribute->data) { |
| 67 | CipUsint *data = (CipUsint *) attribute->data; |
| 68 | *(data) = attribute_value_recieved; |
| 69 | |
| 70 | message_router_response->general_status = kCipErrorSuccess; |
| 71 | } else { |
| 72 | message_router_response->general_status = kCipErrorNotEnoughData; |
| 73 | OPENER_TRACE_INFO("CIP QoS not enough data\n"); |
| 74 | } |
| 75 | } else { |
| 76 | message_router_response->general_status = kCipErrorInvalidAttributeValue; |
| 77 | } |
| 78 | } else { |
| 79 | /* we don't have this attribute */ |
| 80 | message_router_response->general_status = kCipErrorAttributeNotSupported; |
| 81 | } |
| 82 | |
| 83 | message_router_response->size_of_additional_status = 0; |
| 84 | message_router_response->data_length = 0; |
| 85 | message_router_response->reply_service = (0x80 |
| 86 | | message_router_request->service); |
| 87 | |
| 88 | return kEipStatusOkSend; |
| 89 | } |
| 90 | |
| 91 | CipUsint GetPriorityForSocket(ConnectionObjectPriority priority) { |
| 92 |
nothing calls this directly
no test coverage detected