Example #1
0
        public void FromDHCP()
        {
            Int32 retval = -1;

            Proto.ProtoRobotList list = new Proto.ProtoRobotList();

            unsafe
            {
                void *r_data = null;
                int   r_len  = 0;
                retval = NetInterface.NetPostSyncPackageWithoutId((int)NetInterface.PKTTYPE.kAgvShellProtoProto_GetDHCPList, null, 0, &r_data, &r_len);
                if (retval < 0 || null == r_data)
                {
                    return;
                }

                byte[] ack_msg = null;

                ack_msg = new byte[r_len];
                using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                {
                    ms.Read(ack_msg, 0, ack_msg.Length);
                }

                Tool.Proto.Unpackage <Proto.ProtoRobotList> info = new Proto.Unpackage <Proto.ProtoRobotList>(ack_msg);
                if (info.build())
                {
                    list = info.ob;
                }
                NetInterface.FreeDetail(r_data);
            }

            Dictionary <string, RobotInfo> varDict = new Dictionary <string, RobotInfo>();

            Collection.Clear();
            foreach (Proto.ProtoRobotInfo node in list.RobotList)
            {
                RobotInfo info = new RobotInfo();
                info.Id       = node.CarID.value_;
                info.EndPoint = node.IPV4.value_ + ":" + node.AGVPort.value_;
                info.NetId    = -(ItemCount++);
                info.NetState = false;
                info.Fts      = node.IPV4.value_ + ":" + node.FTSPort.value_;
                info.MacAddr  = node.Mac.value_;
                info.Id       = node.CarID.value_;
                if (varDict.ContainsKey(info.EndPoint))
                {
                    continue;
                }
                varDict.Add(info.EndPoint, info);
                Collection.Add(info);
            }
        }
Example #2
0
        private void OnClickConfigPage(object sender, MouseButtonEventArgs e)
        {
            TextBlock text  = sender as TextBlock;
            string    ftsIP = text.Tag.ToString();

            Int32 retval = -1;

            Proto.ProtoFolderList folderList = new Proto.ProtoFolderList();
            this.WaitEvent(() =>
            {
                unsafe
                {
                    void *r_data = null;
                    int r_len    = 0;
                    retval       = NetInterface.NetGetRomoteListDir(ftsIP, "./", &r_data, &r_len);

                    byte[] ack_msg = null;

                    ack_msg = new byte[r_len];
                    using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                    {
                        ms.Read(ack_msg, 0, ack_msg.Length);
                    }

                    Tool.Proto.Unpackage <Proto.ProtoFolderList> list = new Proto.Unpackage <Proto.ProtoFolderList>(ack_msg);
                    if (list.build())
                    {
                        folderList = list.ob;
                    }
                    NetInterface.FreeDetail(r_data);
                }
            }, true, true);

            if (retval < 0)
            {
                string str = string.Format("获取文件信息失败,错误码:{0}", retval);
                this.ShowNotify(str, "错误");
                return;
            }
            Tool.MainWindow.This.NaviToPageConfig(ftsIP, folderList, 0);
        }
Example #3
0
        private void OnClickedCheck(object sender, RoutedEventArgs e)
        {
            Tool.XControl.XButton Btn = sender as Tool.XControl.XButton;
            string net_id             = Btn.Tag.ToString();

            Int32 retval = -1;

            Proto.ProtoProcessDetail list = new Proto.ProtoProcessDetail();

            this.WaitEvent(() =>
            {
                unsafe
                {
                    void *r_data = null;
                    int r_len    = 0;
                    retval       = NetInterface.NetPostSyncPackage(Convert.ToInt32(net_id), (int)NetInterface.PKTTYPE.kAgvShellProto_ProcessDetail, null, 0, &r_data, &r_len);
                    if (retval < 0 || null == r_data)
                    {
                        return;
                    }

                    byte[] ack_msg = null;

                    ack_msg = new byte[r_len];
                    using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                    {
                        ms.Read(ack_msg, 0, ack_msg.Length);
                    }

                    Tool.Proto.Unpackage <Proto.ProtoProcessDetail> info = new Proto.Unpackage <Proto.ProtoProcessDetail>(ack_msg);
                    if (info.build())
                    {
                        list = info.ob;
                    }
                    NetInterface.FreeDetail(r_data);
                }
            }, true, true);

            WinProcessDetail.Show(this, list, net_id);
        }
Example #4
0
        private void ChangeCarList(string ftsEndPoint, int SelectIndex)
        {
            Int32 retval = -1;

            Proto.ProtoFolderList folderList = new Proto.ProtoFolderList();
            this.WaitEvent(() =>
            {
                unsafe
                {
                    void *r_data = null;
                    int r_len    = 0;
                    retval       = NetInterface.NetGetRomoteListDir(ftsEndPoint, "./", &r_data, &r_len);

                    byte[] ack_msg = null;

                    ack_msg = new byte[r_len];
                    using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                    {
                        ms.Read(ack_msg, 0, ack_msg.Length);
                    }

                    Tool.Proto.Unpackage <Proto.ProtoFolderList> list = new Proto.Unpackage <Proto.ProtoFolderList>(ack_msg);
                    if (list.build())
                    {
                        folderList = list.ob;
                    }
                    NetInterface.FreeDetail(r_data);
                }
            }, true, true);

            if (retval < 0)
            {
                string str = string.Format("获取文件信息失败,错误码:{0}", retval);
                this.ShowNotify(str, "错误");
                return;
            }
            Tool.MainWindow.This.NaviToPageConfig(ftsEndPoint, folderList, SelectIndex);
        }
Example #5
0
        //初始化Remote文件列表信息
        private void InitRemoteList()
        {
            Int32 retval = -1;

            Proto.ProtoFileList fileList = new Proto.ProtoFileList();

            this.Dispatcher.Invoke(() => {
                unsafe
                {
                    void *r_data = null;
                    int r_len    = 0;
                    retval       = NetInterface.NetQueryCurrentCatalog(EP, DirRelative, &r_data, &r_len);
                    if (r_len == 0)
                    {
                        return;
                    }

                    byte[] ack_msg = null;
                    ack_msg        = new byte[r_len];
                    using (UnmanagedMemoryStream ms = new UnmanagedMemoryStream((byte *)r_data, r_len))
                    {
                        ms.Read(ack_msg, 0, ack_msg.Length);
                    }

                    Tool.Proto.Unpackage <Proto.ProtoFileList> list = new Proto.Unpackage <Proto.ProtoFileList>(ack_msg);
                    if (list.build())
                    {
                        fileList = list.ob;
                    }

                    NetInterface.FreeDetail(r_data);
                }
            });

            if (retval < -1)
            {
                NotifyMessageEx.ShowNotify(Tool.MainWindow.This, "获取车载文件列表失败", "错误");
                return;
            }

            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1601, 1, 1));

            foreach (var obj in fileList.FileListList)
            {
                FileDetailInfo Info = new FileDetailInfo();
                Info.FileName = obj.FileName.value_;
                Info.IsEnable = true;
                if (".\\" == DirRelative)
                {
                    Info.RemoteDir = DirRelative + Info.FileName;
                }
                else
                {
                    Info.RemoteDir = DirRelative + "\\" + Info.FileName;
                }

                if (0 == obj.FileType.value_)
                {
                    Info.IsDir = true;
                }

                Info.RemoteCRC = obj.FileCRC32.value_.ToString();
                DateTime targetDt = dtStart.AddTicks((long)obj.FileModifyTime.value_);
                Info.MotifyRemoteTime = targetDt.ToString();
                Info.FileSize         = obj.FileSize.value_;
                RemoteList.Add(Info);
            }
        }