コード例 #1
0
ファイル: h_ihave.c プロジェクト: beh9540/bacnetwx2
void handler_i_have(
    uint8_t * service_request,
    uint16_t service_len,
    BACNET_ADDRESS * src)
{
    int len = 0;
    BACNET_I_HAVE_DATA data;

    (void) service_len;
    (void) src;
    len = ihave_decode_service_request(service_request, service_len, &data);
    if (len != -1) {
#if PRINT_ENABLED
        fprintf(stderr, "I-Have: %s %d from %s %u!\r\n",
            bactext_object_type_name(data.object_id.type),
            data.object_id.instance,
            bactext_object_type_name(data.device_id.type),
            data.device_id.instance);
#endif
    } else {
#if PRINT_ENABLED
        fprintf(stderr, "I-Have: received, but unable to decode!\n");
#endif
    }

    return;
}
コード例 #2
0
ファイル: ihave.c プロジェクト: HITliuyu/NES15_HEVC
int ihave_decode_apdu(
    uint8_t * apdu,
    unsigned apdu_len,
    BACNET_I_HAVE_DATA * data)
{
    int len = 0;

    if (!apdu)
        return -1;
    /* optional checking - most likely was already done prior to this call */
    if (apdu[0] != PDU_TYPE_UNCONFIRMED_SERVICE_REQUEST)
        return -1;
    if (apdu[1] != SERVICE_UNCONFIRMED_I_HAVE)
        return -1;
    len = ihave_decode_service_request(&apdu[2], apdu_len - 2, data);

    return len;
}