merged two functions to avoid confusion
This commit is contained in:
+24
-16
@@ -163,21 +163,6 @@ int encode_closing_tag(uint8_t * apdu, uint8_t tag_number)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
// from clause 20.2.1.3.2 Constructed Data
|
|
||||||
// returns the number of apdu bytes consumed
|
|
||||||
int decode_tag_number(uint8_t * apdu, uint8_t * tag_number)
|
|
||||||
{
|
|
||||||
int len = 1;
|
|
||||||
|
|
||||||
if ((apdu[0] & 0xF0) == 0xF0) {
|
|
||||||
*tag_number = apdu[1];
|
|
||||||
len++;
|
|
||||||
} else
|
|
||||||
*tag_number = (apdu[0] >> 4);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
// from clause 20.2.1.3.2 Constructed Data
|
// from clause 20.2.1.3.2 Constructed Data
|
||||||
// returns the number of apdu bytes consumed
|
// returns the number of apdu bytes consumed
|
||||||
bool decode_is_context_specific(uint8_t * apdu)
|
bool decode_is_context_specific(uint8_t * apdu)
|
||||||
@@ -201,7 +186,22 @@ bool decode_is_closing_tag(uint8_t * apdu)
|
|||||||
|
|
||||||
// from clause 20.2.1.3.2 Constructed Data
|
// from clause 20.2.1.3.2 Constructed Data
|
||||||
// returns the number of apdu bytes consumed
|
// returns the number of apdu bytes consumed
|
||||||
int decode_tag_value(uint8_t * apdu, uint32_t * value)
|
static int decode_tag_number(uint8_t * apdu, uint8_t * tag_number)
|
||||||
|
{
|
||||||
|
int len = 1;
|
||||||
|
|
||||||
|
if ((apdu[0] & 0xF0) == 0xF0) {
|
||||||
|
*tag_number = apdu[1];
|
||||||
|
len++;
|
||||||
|
} else
|
||||||
|
*tag_number = (apdu[0] >> 4);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
// from clause 20.2.1.3.2 Constructed Data
|
||||||
|
// returns the number of apdu bytes consumed
|
||||||
|
static int decode_tag_value(uint8_t * apdu, uint32_t * value)
|
||||||
{
|
{
|
||||||
int len = 1;
|
int len = 1;
|
||||||
union {
|
union {
|
||||||
@@ -257,6 +257,14 @@ int decode_tag_value(uint8_t * apdu, uint32_t * value)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do both tag number and value so that len is returned correctly
|
||||||
|
static int decode_tag_number_and_value(uint8_t * apdu, uint8_t * tag_number,
|
||||||
|
uint32_t * value)
|
||||||
|
{
|
||||||
|
(void)decode_tag_number(apdu, tag_number);
|
||||||
|
return decode_tag_value(apdu, value);
|
||||||
|
}
|
||||||
|
|
||||||
// from clause 20.2.6 Encoding of a Real Number Value
|
// from clause 20.2.6 Encoding of a Real Number Value
|
||||||
// returns the number of apdu bytes consumed
|
// returns the number of apdu bytes consumed
|
||||||
int decode_real(uint8_t * apdu, float *real_value)
|
int decode_real(uint8_t * apdu, float *real_value)
|
||||||
|
|||||||
+4
-14
@@ -45,22 +45,12 @@ int encode_tag(uint8_t * apdu, uint8_t tag_number, bool context_specific,
|
|||||||
// from clause 20.2.1.3.2 Constructed Data
|
// from clause 20.2.1.3.2 Constructed Data
|
||||||
// returns the number of apdu bytes consumed
|
// returns the number of apdu bytes consumed
|
||||||
int encode_opening_tag(uint8_t * apdu, uint8_t tag_number);
|
int encode_opening_tag(uint8_t * apdu, uint8_t tag_number);
|
||||||
|
|
||||||
// from clause 20.2.1.3.2 Constructed Data
|
|
||||||
// returns the number of apdu bytes consumed
|
|
||||||
int encode_closing_tag(uint8_t * apdu, uint8_t tag_number);
|
int encode_closing_tag(uint8_t * apdu, uint8_t tag_number);
|
||||||
|
static int decode_tag_number_and_value(uint8_t * apdu, uint8_t * tag_number,
|
||||||
// from clause 20.2.1.3.2 Constructed Data
|
uint32_t * value);
|
||||||
// returns the number of apdu bytes consumed
|
|
||||||
int decode_tag_number(uint8_t * apdu, uint8_t * tag_number);
|
|
||||||
|
|
||||||
// from clause 20.2.1.3.2 Constructed Data
|
|
||||||
// returns the number of apdu bytes consumed
|
|
||||||
bool decode_is_context_specific(uint8_t * apdu);
|
bool decode_is_context_specific(uint8_t * apdu);
|
||||||
|
bool decode_is_opening_tag(uint8_t * apdu);
|
||||||
// from clause 20.2.1.3.2 Constructed Data
|
bool decode_is_closing_tag(uint8_t * apdu);
|
||||||
// returns the number of apdu bytes consumed
|
|
||||||
int decode_tag_value(uint8_t * apdu, uint32_t * value);
|
|
||||||
|
|
||||||
// from clause 20.2.6 Encoding of a Real Number Value
|
// from clause 20.2.6 Encoding of a Real Number Value
|
||||||
// and 20.2.1 General Rules for Encoding BACnet Tags
|
// and 20.2.1 General Rules for Encoding BACnet Tags
|
||||||
|
|||||||
Reference in New Issue
Block a user