Exemplo n.º 1
0
        private Boolean WriteELDRecord()
        {
            String       ELDRecord  = "";
            const String DateFormat = "M/d/yyyy H:mm:ss";

            String RecordIdText;

            ELD.RecordIds _RecordId = (ELD.RecordIds)ELD.RecordId;

            if (_RecordId == ELD.RecordIds.Waiting)
            {
                return(true);
            }

            if (_RecordId >= ELD.RecordIds.Custom)
            {
                RecordIdText = ((CustomRecordIds)(_RecordId - ELD.RecordIds.Custom)).ToString();
            }
            else
            {
                RecordIdText = _RecordId.ToString();
            }

            String DriverVIN = "";

            if (_RecordId < ELD.RecordIds.Custom)
            {
                if (_RecordId == ELD.RecordIds.DriverId)
                {
                    DriverVIN = ELD.DriverId;
                }
                else
                {
                    DriverVIN = ELD.VIN;
                }
            }

            ELDRecord += ELD.RecordNo + "," +
                         ELD.RecordId + "," +
                         RecordIdText + "," +
                         DriverVIN + "," +
                         Helper.FormatDate(ELD.Time.Ticks, DateFormat, true) + "," +
                         Helper.FormatLatLong(ELD.Latitude, LatLongShowNA) + "," +
                         Helper.FormatLatLong(ELD.Longitude, LatLongShowNA) + "," +
                         Helper.FormatDistance(ELD.Distance, DistanceShowNA, false, true) + "," +
                         Helper.FormatDistance(ELD.Odometer, OdometerShowNA, false, true) + "," +
                         Helper.FormatEngineHours(ELD.TotalHours, TotalHoursShowNA, true) + "," +
                         Helper.FormatEngineHours(ELD.IdleHours, IdleHoursShowNA, true) + "," +
                         Helper.FormatFuelUsed(ELD.TotalFuel, TotalFuelShowNA, false, true) + "," +
                         Helper.FormatFuelUsed(ELD.IdleFuel, IdleFuelShowNA, false, true);

            // Write log record
            Debug.WriteLine(ELDRecord);

            return(true);
        }
Exemplo n.º 2
0
        private void SendCustomRecord(ELD.RecordIds RecordId)
        {
            Byte CustomId = (Byte)((Byte)ELD.RecordIds.Custom + (Byte)RecordId);

            // Set the data to whatever
            Byte[] CustomData = new Byte[ELD.CustomDataLength];
            CustomData[0] = 1;
            CustomData[1] = 2;

            // Send the custom record to the adapter
            ELD.WriteRecord(CustomId, CustomData);
        }