Ejemplo n.º 1
0
        public WarpAdbManager(DeviceManager manager)
        {
            DeviceManager = manager;

            AdbServerStatus status = AdbServer.Instance.GetStatus();

            if (!status.IsRunning)
            {
                SystemLog.E(TAG, "ADB 没有运行! 重新启动ADB...");
                AdbServer.Instance.StartServer(adbpath, true);
            }
            status = AdbServer.Instance.GetStatus();
            if (status.IsRunning)
            {
                InitAdbSocket();
                Moniter();

                //不必要要此处初始化,一直连着电脑里,也会被MOniter到.
                //try
                //{
                //    CurrentDeviceData = AdbClient.Instance.GetDevices().First();
                //    SystemLog.I(TAG, "初始获得设备连接:" + CurrentDeviceData.Name);
                //}
                //catch
                //{
                //    SystemLog.E(TAG, "初始获得设备连接错误:");
                //}
            }
            ProgLog.D(TAG, "" + status.Version + ".." + status.IsRunning);
        }
Ejemplo n.º 2
0
        private void ChooseChipFrom_VisibleChanged(object sender, EventArgs e)
        {
            ProgLog.D("", "ChooseChipFrom_VisibleChanged  visable: " + Visible);
            if (Visible)
            {
                searchComBox.Items.Clear();
                List <string> history = DeviceManager.Instance.ConfigManager.GetSavedChooseChipHistory();

                searchComBox.Items.AddRange(history.ToArray());
            }
        }
Ejemplo n.º 3
0
        //private int index = 0;

        private void test()
        {
            ProgLog.D(TAG, "nettyrest");
            //MYNetttyTest.Stop();
            //MYNetttyTest.Start();
            // Device device = new Device(new DeviceData());
            //if (currentDevice != null && currentDevice.IsOnline)
            //{
            //  var dataprop =   currentDevice.GetProperty("viatel.device.excp.data");
            //    ProgLog.D(TAG, ".." + dataprop);
            //}
        }
Ejemplo n.º 4
0
        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            //前面用了string decoder, 所以应当为
            var receiverMsg = message as string;

            if (DeviceManager.Instance.RxMsgDispatch != null && !string.IsNullOrEmpty(receiverMsg))
            {
                DeviceManager.Instance.RxMsgDispatch.ProcessRxMsg(receiverMsg);
            }

            ProgLog.D(TAG, "NEtty收到数据: " + receiverMsg);
        }
Ejemplo n.º 5
0
        public async void Init()
        {
            await Task.Run(() => {
                ProgLog.D(TAG, " DeviceManager init.." + DateTime.Now);
                _dataBaseManager    = new DataBaseManager(this);
                _ChipSupportManager = new ChipSupportManager(this);
                _ConfigManager      = new ConfigManager(this);
                _projectManager     = new ProjectManager();
                _WrapAdbManager     = new WarpAdbManager(this);
                ProgLog.D(TAG, " DeviceManager end.." + DateTime.Now);
                //event
                DeviceManagerStatusChanged?.Invoke(this, new EventArgs());
            });

            _uaseAble = true;
        }
Ejemplo n.º 6
0
        public void ProcessRxMsg(string str)
        {
            if (string.IsNullOrEmpty(str))
            {
                return;
            }
            RxMsgHandlerBase rxMsgHandler = null;

            try
            {
                JObject obj     = JObject.Parse(str);
                string  msgtype = obj[MsgBase.MSG_TYPE_STRING].ToString();
                if (!_SupportRxMsg.Contains(msgtype))
                {
                    //   return;
                }
                ProgLog.D(TAG, "the msgtype is " + msgtype);
                switch (msgtype)
                {
                case MsgBase.MSG_TYPE_INFO:
                    rxMsgHandler = new RxMsgHandlerInfo(deviceManager);
                    break;

                case MsgBase.MSG_TYPE_TEST:
                    rxMsgHandler = new RxMsgHandlerTest(deviceManager);
                    break;

                default:
                    break;
                }

                if (rxMsgHandler != null)
                {
                    rxMsgHandler.Msg = str;
                }
            }
            catch (Exception e)
            {
                ProgLog.D(TAG, "ProcessRxMsg error: " + e.ToString());
            }

            if (rxMsgHandler != null)
            {
                Task.Run(new Action(rxMsgHandler.Process));
            }
        }
Ejemplo n.º 7
0
        private void ChipInfoListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            var ci  = sender as ListView;
            var itm = ci.SelectedItems;

            foreach (ListViewItem lvi in itm)
            {
                ProgLog.D("", "ChipInfoListView_ItemSelectionChanged lvi " + lvi.Name + " lvi " + lvi.Text);
                searchComBox.Text = lvi.Text;
                foreach (ChipInfo chip in _AllChipList)
                {
                    if (chip.name.Equals(lvi.Text))
                    {
                        _CurrentChooseChip = chip;
                    }
                }
            }
            // ProgLog.D("", "ChipInfoListView_ItemSelectionChanged " + e.IsSelected + " " + e.Item.Name + ".." + e.Item.Text);
        }
Ejemplo n.º 8
0
        private async void BindAdbStatus()
        {
            ProgLog.D(TAG, "aync bindadbstatus begain " + DateTime.Now);
            await Task.Factory.StartNew(() =>
            {
                // init first.
                var adbdevicedata = DeviceManager.Instance.WrapAdbManager.GetCurrentAdbDeviceData();
                if (adbdevicedata.State.Equals(DeviceState.Online))
                {
                    SystemLog.I(TAG, "初始化找到ADB设备 :" + adbdevicedata.ToString());
                    AdbStatusToollable.Text = "设备已连接";
                    Task.Run(new Action(startNetty));
                }
                else if (adbdevicedata.State.Equals(DeviceState.Offline))
                {
                    SystemLog.I(TAG, "初始化末找到ADB设备 :" + adbdevicedata.ToString());
                    AdbStatusToollable.Text = "设备已断开";
                    NettyJsonCmdManager?.Stop();
                }
                // add monitoer
                DeviceManager.Instance.WrapAdbManager.DeviceStatusChanged += delegate(object sender, DeviceDataEventArgs data)
                {
                    var devicedata = data.Device;
                    if (devicedata.State.Equals(DeviceState.Online))
                    {
                        SystemLog.I(TAG, "设备连接 :" + devicedata.ToString());
                        AdbStatusToollable.Text = "设备已连接";
                        Task.Run(new Action(startNetty));
                    }
                    else if (devicedata.State.Equals(DeviceState.Offline))
                    {
                        SystemLog.I(TAG, "设备已断开 :" + devicedata.ToString());
                        AdbStatusToollable.Text = "设备已断开";
                        NettyJsonCmdManager?.Stop();
                    }
                };
            });

            ProgLog.D(TAG, "aync bindadbstatus end " + DateTime.Now);
        }
Ejemplo n.º 9
0
        private void InitDBmodul()
        {
            var sql  = "select * from " + ChipInfo.TYPE_TABLE_NAME_CHIPINFO + ";";
            var read = _DeviceManager.DataBaseManager.ExeGetReader(sql);

            if (read == null || !read.HasRows)
            {
                return;
            }
            _venderseriesDictionary.Clear();
            _allchipvendorlistDic.Clear();
            _allChipInfo.Clear();

            while (read.Read())
            {
                try
                {
                    var chipinfo           = new ChipInfo();
                    NameValueCollection nv = read.GetValues();
                    chipinfo.vendor = "" + nv.Get(ChipInfo.TYPE_COLUMN_VENDOR);
                    var series = nv.Get(ChipInfo.TYPE_COLUMN_SERIES);

                    chipinfo.series  = "" + nv.Get(ChipInfo.TYPE_COLUMN_SERIES);
                    chipinfo.name    = nv.Get(ChipInfo.TYPE_COLUMN_NAME);
                    chipinfo.type    = nv.Get(ChipInfo.TYPE_COLUMN_TYPE);
                    chipinfo.package = nv.Get(ChipInfo.TYPE_COLUMN_PACKAGE);
                    chipinfo.burner  = nv.Get(ChipInfo.TYPE_COLUMN_BURNER);
                    chipinfo.note    = nv.Get(ChipInfo.TYPE_COLUMN_NOTE);

                    _allChipInfo.Add(chipinfo);

                    ProgLog.D(TAG, chipinfo.ToString());
                }
                catch (Exception e)
                {
                    SystemLog.E(TAG, " get chipinfo error " + e.ToString());
                }
            }
            read.Close();
        }
Ejemplo n.º 10
0
        private void ChipTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeView tv = sender as TreeView;
            TreeNode tn = tv.SelectedNode;

            ProgLog.D("ChipTreeView_AfterSelect.." + tn.Text + " " + tn.Index + "--" + tn.FullPath + " ");
            if (tn.FullPath.Contains(@"\"))
            {
                //List<ChipInfo> chipinfolist =
                //    DeviceManager.Instance.ChipSupportManager.GetChipInfo(tn.Parent.Text, tn.Text);

                var chipinfolist = new List <ChipInfo>();
                foreach (ChipInfo chip in _AllChipList)
                {
                    if (tn.Parent.Text.Equals(chip.vendor) && tn.Text.Equals(chip.series))
                    {
                        chipinfolist.Add(chip);
                    }
                }
                LoadChipList2UI(chipinfolist);
            }
        }
Ejemplo n.º 11
0
 public void Start()
 {
     ProgLog.D(TAG, ".Start called");
     RunClientAsync();
 }
Ejemplo n.º 12
0
 public void Stop()
 {
     ProgLog.D(TAG, ".Stop called");
     clientChannel?.CloseAsync();
     group?.ShutdownGracefullyAsync();
 }
Ejemplo n.º 13
0
 public void Dispose()
 {
     ProgLog.D(TAG, ".Dispose called");
     Stop();
 }
Ejemplo n.º 14
0
 protected void D(object o)
 {
     ProgLog.D(TAG, o);
 }
Ejemplo n.º 15
0
 private void D(object o)
 {
     ProgLog.D(TAG, o);
 }
Ejemplo n.º 16
0
 private void searchComBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     ProgLog.D("", "searchComBox_SelectedIndexChanged");
 }
Ejemplo n.º 17
0
 private void searchComBox_TextChanged(object sender, EventArgs e)
 {
     ProgLog.D("", "searchComBox_TextChanged");
 }