/* Functions for BACnetDeviceObjectReference: */
int bacapp_encode_context_device_obj_ref(
    uint8_t * apdu,
    uint8_t tag_number,
    BACNET_DEVICE_OBJECT_REFERENCE * value)
{
    int len;
    int apdu_len = 0;

    len = encode_opening_tag(&apdu[apdu_len], tag_number);
    apdu_len += len;

    len = bacapp_encode_device_obj_ref(&apdu[apdu_len], value);
    apdu_len += len;

    len = encode_closing_tag(&apdu[apdu_len], tag_number);
    apdu_len += len;

    return apdu_len;
}
示例#2
0
static void testDevIdRef(
    Test * pTest)
{
    BACNET_DEVICE_OBJECT_REFERENCE inData;
    BACNET_DEVICE_OBJECT_REFERENCE outData;
    uint8_t buffer[MAX_APDU];
    int inLen;
    int outLen;

    inData.deviceIndentifier.instance = 0x4343;
    inData.deviceIndentifier.type = OBJECT_DEVICE;
    inLen = bacapp_encode_device_obj_ref(buffer, &inData);
    outLen = bacapp_decode_device_obj_ref(buffer, &outData);
    ct_test(pTest, outLen == inLen);
    ct_test(pTest,
        inData.deviceIndentifier.instance ==
        outData.deviceIndentifier.instance);
    ct_test(pTest,
        inData.deviceIndentifier.type == outData.deviceIndentifier.type);
}