private void WriteEffectivePeriod() { // Manual ASN.1/BER encoding EncodeBuffer b = comm.GetEncodeBuffer(0); ASN1.encode_opening_tag(b, 3); DateTime dt; if (TxtStartDate.Text != "Always") { dt = Convert.ToDateTime(TxtStartDate.Text); } else { dt = new DateTime(0); } ASN1.encode_application_date(b, dt); if (TxtEndDate.Text != "Always") { dt = Convert.ToDateTime(TxtEndDate.Text); } else { dt = new DateTime(0); } ASN1.encode_application_date(b, dt); ASN1.encode_closing_tag(b, 3); Array.Resize <byte>(ref b.buffer, b.offset); byte[] InOutBuffer = b.buffer; comm.RawEncodedDecodedPropertyConfirmedRequest(adr, schedule_id, BacnetPropertyIds.PROP_EFFECTIVE_PERIOD, BacnetConfirmedServices.SERVICE_CONFIRMED_WRITE_PROPERTY, ref InOutBuffer); }