template <int _tmpl>::uavcan::DataTypeSignature NodeStatus_<_tmpl>::getDataTypeSignature(){::uavcan::DataTypeSignature signature(0xF0868D0C1A7C6F1ULL);FieldTypes::uptime_sec::extendDataTypeSignature(signature);FieldTypes::health::extendDataTypeSignature(signature);FieldTypes::mode::extendDataTypeSignature(signature);FieldTypes::sub_mode::extendDataTypeSignature(signature);FieldTypes::vendor_specific_status_code::extendDataTypeSignature(signature);return signature;}
Can anyone provide some example for the Data type signature that implement by C langue,and shown the process for get signature resule.
--
You received this message because you are subscribed to the Google Groups "UAVCAN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+unsubscribe@googlegroups.com.
To post to this group, send email to uav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/uavcan/a3c1aba0-e48d-4020-bf15-4ac6522911e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The following is a data type signature computation algorithm for a given data type, where hash is the signature hash function described earlier:The resulting hash value will be the data type signature.
- Initialize the hash value with the DSDL signature of the given type.
- Starting from the top of the DSDL definition, do the following for each nested data structure:
- Extend the current hash value with the data type signature of the nested data structure.
The hash extension algorithm:The data type signature computation algorithm has the following properties:
- Save the current hash value.
- Feed the value the hash needs to be extended with to the hash function, byte by byte, LSB first.
- Feed the saved hash value to the hash function, byte by byte, LSB first.
- Data type signature and DSDL signature of the same type are equal if the data type does not contain nested data structures.
- Data type signature is guaranteed to match only if all nested data structures are compatible.
--
You received this message because you are subscribed to the Google Groups "UAVCAN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+unsubscribe@googlegroups.com.
To post to this group, send email to uav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/uavcan/2e2a30c9-3f62-4553-b1d3-b782b5cc86cb%40googlegroups.com.
import structdef bytes_from_crc64(crc64): # Cast to str explicitly for Python 2.7 compatibility when # unicode_literals is enabled return bytes(struct.pack(str("<Q"), crc64))
#get DSDL signature nodeinfonodeinfo_str = "uavcan.protocol.GetNodeInfo\nNodeStatus status\nSoftwareVersion software_version\nHardwareVersion hardware_version\nsaturated uint8[<=80] name";sing = Signature();sing.add(nodeinfo_str);nodeinfo_sig = sing.get_value();
#get data type signature of nodestatus,there no nested data type,so equal to DSDL signature;the following below are same case.nodestatus_str = "uavcan.protocol.NodeStatus\nsaturated uint32 uptime_sec\nsaturated uint2 health\nsaturated uint3 mode\nsaturated uint3 sub_mode\nsaturated uint16 vendor_specific_status_code";sing = Signature();sing.add(nodestatus_str);nodestatus_sig = sing.get_value();
#get data type signature of softwaresoftware_str = "uavcan.protocol.SoftwareVersion\nsaturated uint8 major\nsaturated uint8 minor\nsaturated uint8 optional_field_flags\nsaturated uint32 vcs_commit\nsaturated uint64 image_crc";sing = Signature();sing.add(software_str);software_sig = sing.get_value();
#get data type signature of hardware hardware_str = "uavcan.protocol.HardwareVersion\nsaturated uint8 major\nsaturated uint8 minor\nsaturated uint8[16] unique_id\nsaturated uint8[<=255] certificate_of_authenticity";sing = Signature();sing.add(hardware_str);hardware_sig = sing.get_value();
#init the signature with the DSDL signature of the nodeinfosing = Signature(nodeinfo_sig);
#extend nodestatus signaturesig_vl = sing.get_value();sing.add(bytes_from_crc64(nodestatus_sig));sing.add(bytes_from_crc64(sig_vl));
#extern software signaturesig_vl = sing.get_value();sing.add(bytes_from_crc64(software_sig));sing.add(bytes_from_crc64(sig_vl));
#extern hardware signaturesig_vl = sing.get_value();sing.add(bytes_from_crc64(hardware_sig));sing.add(bytes_from_crc64(sig_vl));
print("The CRC64 is 0x%016x"%(sing.get_value()));Can anyone provide some example for the Data type signature that implement by C langue,and shown the process for get signature resule.
--
You received this message because you are subscribed to the Google Groups "UAVCAN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+unsubscribe@googlegroups.com.
To post to this group, send email to uav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/uavcan/f7e59396-32c1-4793-89d0-6adde0f869c4%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+un...@googlegroups.com.
To post to this group, send email to uav...@googlegroups.com.