Beispiel #1
0
        /// <summary>
        /// Parameter Message to Parameter instance.
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public static VehicleParameter ConvertToParameter(Message_PARAM_VALUE message)
        {
            if (!message.IsValid)
            {
                return(null);
            }

            try
            {
                VehicleParameter temp = new VehicleParameter();
                temp.Id    = message.param_id;
                temp.Index = message.param_index;
                temp.Type  = message.param_type;
                temp.Value = message.param_value;
                return(temp);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Beispiel #2
0
        private object Receive_ESC_CALIBRATION_VALUE(Packet packet)
        {
            if (packet is null)
            {
                return(false);
            }

            Message_PARAM_VALUE message = (Message_PARAM_VALUE)packet.Message;

            if (message.IsValid)
            {
                string id = Encoding.ASCII.GetString(message.param_id).TrimEnd('\0');
                if (id == "ESC_CALIBRATION" & message.param_value == 3)
                {
                    this.IsStart = true;
                }
                return(true);
            }


            return(false);
        }