Beispiel #1
0
        public virtual GlobalsatSystemConfiguration ResponseGetSystemConfiguration()
        {
            //No reasonable check for CheckOffset()
            string deviceName    = ByteArr2String(0, 20 + 1);
            string firmware      = ByteArr2String(25, 16 + 1); //21wo version
            int    waypointCount = 0;
            int    pcRouteCount  = 0;

            if (this.PacketLength > this.SystemConfigWaypointCountOffset)
            {
                waypointCount = (int)PacketData[this.SystemConfigWaypointCountOffset];
                pcRouteCount  = (int)PacketData[this.SystemConfigPcRouteCountOffset];
            }
            else
            {
                ReportOffset(this.PacketLength, this.SystemConfigWaypointCountOffset);
            }
            GlobalsatSystemConfiguration systemInfo = new GlobalsatSystemConfiguration(deviceName, firmware, waypointCount, pcRouteCount);

            return(systemInfo);
        }
Beispiel #2
0
        //Not used as a separate protocol now
        //public virtual GlobalsatPacket.GlobalsatSystemInformation GetSystemConfiguration(IJobMonitor jobMonitor)
        //{
        //    this.Open();
        //    try
        //    {
        //        GlobalsatPacket packet = PacketFactory.GetSystemConfiguration();
        //        GlobalsatPacket response = (GlobalsatPacket)this.SendPacket(packet);

        //        GlobalsatPacket.GlobalsatSystemConfiguration systemInfo = response.ResponseGetSystemConfiguration();
        //        return systemInfo;
        //    }
        //    catch(Exception e)
        //    {
        //        throw new Exception(Properties.Resources.Device_GetInfo_Error+e);
        //    }
        //    finally
        //    {
        //        this.Close();
        //    }
        //}

        public virtual GlobalsatDeviceConfiguration GetSystemConfiguration2(IJobMonitor jobMonitor)
        {
            //No need to check if device is connected
            GlobalsatDeviceConfiguration devConfig = new GlobalsatDeviceConfiguration();

            if (this.Open())
            {
                try
                {
                    GlobalsatPacket packet   = PacketFactory.GetSystemConfiguration();
                    GlobalsatPacket response = (GlobalsatPacket)this.SendPacket(packet);

                    GlobalsatSystemConfiguration systemInfo = response.ResponseGetSystemConfiguration();
                    devConfig.DeviceName = systemInfo.DeviceName;

                    packet   = PacketFactory.GetSystemConfiguration2();
                    response = (GlobalsatPacket)this.SendPacket(packet);

                    devConfig.SystemConfigDataRaw = response.PacketData;
                }
                catch (Exception e)
                {
                    devConfig            = null;
                    jobMonitor.ErrorText = Properties.Resources.Device_GetInfo_Error + e;
                }
                finally
                {
                    this.Close();
                }
            }
            if (!this.DataRecieved)
            {
                NoCommunicationError(jobMonitor);
            }
            return(devConfig);
        }