public static int Decode_Date(ref Byte[] apdu, ref BACNET_DATE bdate, int pos) { bdate.year = (UInt16)apdu[pos + 0]; bdate.month = apdu[pos + 1]; bdate.day = apdu[pos + 2]; bdate.wday = apdu[pos + 3]; return(4); }
public static int Decode_Application_Date(ref Byte[] apdu, ref BACNET_DATE bdate, int pos) { int len = 0; Byte tag_number = 0; Decode_Tag_Number(ref apdu, ref tag_number, pos + len); tag_number = (Byte)BACNET_APPLICATION_TAG.BACNET_APPLICATION_TAG_DATE; len++; len += Decode_Date(ref apdu, ref bdate, pos + len); return(len); }
public static int Encode_Application_Date(ref Byte[] apdu, ref BACNET_DATE bdate, int pos) { int len = 0; if (bdate.year >= 1900) { apdu[pos + 1] = (Byte)(bdate.year - 1900); } else if (bdate.year < 0x100) { apdu[pos + 1] = (Byte)bdate.year; } apdu[pos + 2] = bdate.month; apdu[pos + 3] = bdate.day; apdu[pos + 4] = bdate.wday; len = 4; len += Encode_Tag(ref apdu, (Byte)BACNET_APPLICATION_TAG.BACNET_APPLICATION_TAG_DATE, false, (UInt32)len, pos + 0); return(len); }