Пример #1
0
        /// <summary>
        /// I was hoping to invoke this only once, after ConfigureDpids (which was
        /// supposed to be named "BeginLogging") but I can't get the devices to
        /// relay information without periodically requesting it.
        ///
        /// See also the FAST_LOGGING code in the Logger class and Protocol.Logging.cs.
        /// </summary>
        public async Task <bool> RequestDpids(DpidCollection dpids)
        {
            Message startMessage = this.protocol.RequestDpids(dpids);

            if (!await this.SendMessage(startMessage))
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Create a request to read data from the PCM
        /// </summary>
        public Message RequestDpids(DpidCollection dpids)
        {
#if FAST_LOGGING
            // ResponseType values:
            // 0x01 = send once
            // 0x12 = send slowly
            // 0x13 = send medium
            // 0x24 = send fast
            byte               responseType = 0x24;
            byte[]             header       = new byte[] { Priority.Physical0, DeviceId.Pcm, DeviceId.Tool, Mode.SendDynamicData, responseType };
            byte[]             padding      = new byte[4];// { 0xFF, 0xFF, 0xFF, 0xFF };
            IEnumerable <byte> test         = padding.Take(5 - dpid.Length);
            return(new Message(header.Concat(dpid).Concat(test).ToArray()));
#else
            byte[] header = new byte[] { Priority.Physical0, DeviceId.Pcm, DeviceId.Tool, Mode.SendDynamicData, 0x01 };
            return(new Message(header.Concat(dpids.Values).ToArray()));
#endif
        }
Пример #3
0
        /// <summary>
        /// Invoke this once to begin a logging session.
        /// </summary>
        public async Task <bool> StartLogging()
        {
            this.dpids = await this.vehicle.ConfigureDpids(this.profile);

            if (this.dpids == null)
            {
                return(false);
            }

            await this.vehicle.SetDeviceTimeout(TimeoutScenario.ReadProperty);

#if FAST_LOGGING
            if (!await this.vehicle.RequestDpids(this.dpids))
            {
                return(null);
            }

            this.lastRequestTime = DateTime.Now;
#endif
            return(true);
        }
Пример #4
0
        /// <summary>
        /// Invoke this once to begin a logging session.
        /// </summary>
        public async Task <bool> StartLogging()
        {
            this.dpids = await this.vehicle.ConfigureDpids(this.profileAndMath.Profile);

            if (this.dpids == null)
            {
                return(false);
            }

            int scenario = ((int)TimeoutScenario.DataLogging1 - 1);

            scenario += this.profileAndMath.Profile.ParameterGroups.Count;
            await this.vehicle.SetDeviceTimeout((TimeoutScenario)scenario);

#if FAST_LOGGING
            if (!await this.vehicle.RequestDpids(this.dpids))
            {
                return(false);
            }

            this.lastRequestTime = DateTime.Now;
#endif
            return(true);
        }