コード例 #1
0
        private void DrawLQILine(List <AssocList.DeviceAssocInfo_t> list)
        {
            int StartID = 0;
            int sx, sy, ex, ey;

            AssocList.DeviceAssocInfo_t d;
            while (StartID < list.Count)
            {
                AssocList.DeviceAssocInfo_t dev = list[StartID++];
                sx = dev.x;
                sy = dev.y;
                foreach (AssocList.NeighborInfo_t n in dev.Neighbor)
                {
                    if ((d = AssocList.GetDeviceAssocInfo(n.addr)) != null)
                    {
                        ex = d.x;
                        ey = d.y;
                        DrawLine(n.rxlqi, sx, sy, ex, ey);
                        DrawStringLqi(dev.addr, n.addr, n.rxlqi, dev.text_x, dev.text_y, ex, ey);
                        AssocList.SetTextPoint(n.addr, d.text_x, d.text_y + 25);

                        DrawStringLqi(dev.addr, n.addr, n.rxlqi, ShowLqiString_x, ShowLqiString_y, 0, 0);
                        ShowLqiString_y += 32;
                    }
                }
            }
        }
コード例 #2
0
 public ZigbeeApi(Ztool ztool, System.IO.Ports.SerialPort sp)
 {
     Output      = new ZigbeeOutput();
     Input       = new ZigbeeInput();
     Device      = new ZigbeeDevice();
     myAssocList = new AssocList();
     myZtool     = ztool;
     Instance    = this;
     Uart        = sp;
 }
コード例 #3
0
 public void ReqLqiWithcAssoc()
 {
     foreach (Device_t dev in DeviceList)
     {
         if (AssocList.GetFinishedFlag(dev.addr) == false)
         {
             ZigbeeApi.Instance.ReqAssoc(dev.addr, (byte)0x00);
         }
     }
 }
コード例 #4
0
ファイル: Form2.cs プロジェクト: bingoiot/ZigbeeMaster-for-PC
        private void DrawMap()
        {
            //AssocList.LockList();
            List <AssocList.DeviceAssocInfo_t> tree = AssocList.GetAssocList();

            //if (((tree != null) && (tree.Count != last_count)) || ((runtime % 2 == 0) && (tree.Count>0)))
            if ((tree != null) && (tree.Count > 0))
            {
                last_count = tree.Count;
                myAssocMap.ClearImg();
                myAssocMap.DrawDeviceMap((byte)ZigbeeApi.Device.GetChannel(), (UInt16)ZigbeeApi.Device.GetPanID(), tree);
            }
            //AssocList.ReleaseList();
        }
コード例 #5
0
        private void DrawLayer(List <AssocList.DeviceAssocInfo_t> list, int x, int y, int w, int h)
        {
            float loss = 0;
            int   snd;
            byte  devType = 0;

            if (list != null)
            {
                while (DevStartID < list.Count)
                {
                    int devNum = DevNumPerLine;
                    int sw     = w / (devNum + 1);//分配宽度。
                    y = y + (DevHeight * DevHeightPerLine);
                    int sy = y;
                    for (int i = 0; (DevStartID < list.Count) && (i < devNum); i++)
                    {
                        int rsx = sw * (devNum / 2);//以当前设备的x轴为中心,计算左边起始位置。
                        if (x >= rsx)
                        {
                            rsx = x - rsx;
                        }
                        else
                        {
                            rsx = 0;
                        }
                        int sx = (rsx + (sw * i)) + sw / 2;//计算每个设备的x轴位置
                        AssocList.DeviceAssocInfo_t dev = list[DevStartID++];
                        devType = AssocList.GetDeviceType(dev.addr);
                        switch (devType)
                        {
                        case ZigbeeCommon.DevType_Route:
                            //DrawLine(dev.lqi,x,y,sx,sy);
                            loss = ZigbeeApi.Device.GetLossPercent(dev.addr);
                            snd  = ZigbeeApi.Device.GetSendCount(dev.addr);
                            DrawRouter(dev.addr, 0xFF, loss, snd, sx, sy);
                            dev.x      = sx;
                            dev.y      = sy;
                            dev.text_y = sy;
                            dev.text_x = sx;
                            //DrawLayer(list, sx, sy, sw, sh);
                            break;

                        case ZigbeeCommon.DevType_EndDev:
                            // DrawLine(dev.lqi, x, y, sx, sy);
                            loss = ZigbeeApi.Device.GetLossPercent(dev.addr);
                            snd  = ZigbeeApi.Device.GetSendCount(dev.addr);
                            DrawEndDevice(dev.addr, 0xFF, loss, snd, sx, sy);
                            dev.x      = sx;
                            dev.y      = sy;
                            dev.text_y = sy;
                            dev.text_x = sx;
                            break;

                        default:
                            // DrawLine(dev.lqi, x, y, sx, sy);
                            loss = ZigbeeApi.Device.GetLossPercent(dev.addr);
                            snd  = ZigbeeApi.Device.GetSendCount(dev.addr);
                            DrawOphanDevice(dev.addr, 0xFF, loss, snd, sx, sy);
                            dev.x      = sx;
                            dev.y      = sy;
                            dev.text_y = sy;
                            dev.text_x = sx;
                            break;
                        }
                    }
                }
                DrawLQILine(list);
            }
        }
コード例 #6
0
ファイル: Form2.cs プロジェクト: bingoiot/ZigbeeMaster-for-PC
 private void timer2_Tick_1(object sender, EventArgs e)
 {
     AssocList.ClearList();
     ZigbeeApi.Instance.ReqAssoc(0x0000, (byte)0x00);
     ZigbeeApi.Device.ReqLqiWithcAssoc();
 }