Beispiel #1
0
        void Select()
        {
            article = null;
            article = ReadLine();

            PointCloudDeviceC d = cc.FindDeviceC(article);

            WriteLine(d.ID);

            while (true)
            {
                article = null;
                article = ReadLine();
                switch (article)
                {
                case "back": return;

                case "play": TODO(d, Codemode.play); break;

                case "monitor": TODO(d, Codemode.monitor); break;

                case "sendvolume": TODO(d, Codemode.sendvolume); break;

                case "stopsendvolume": TODO(d, Codemode.stopsendvolume); break;

                case "stop": TODO(d, Codemode.stop); break;
                }
            }
        }
Beispiel #2
0
 void monitor(Codemode codemode)
 {
     deviceC = cc.FindDeviceC(data.DeviceID);
     if (deviceC == null)
     {
         Console.WriteLine("没有此设备"); return;
     }
     deviceC.adduser(this);
     deviceC.addorder(codemode);
 }
Beispiel #3
0
 public void release(int flag = 1)
 {
     if (deviceC != null)
     {
         if (flag == 0 || deviceC.removeuser())
         {
             data.DeviceID = null; deviceC = null; Console.WriteLine("{0}:移除设备", data.ID);
         }
         else
         {
             Console.WriteLine("user can not release");
         }
     }
     else
     {
         Console.WriteLine("DeviceC is null");
     }
 }
Beispiel #4
0
        /// <summary>
        /// 当设备或客户链接时,分配控制器
        /// </summary>
        void CreateThreadToCheckData()
        {
            m.DataLiveEvent += new EventManager.DataLiveHandler(DisposeControl);
            while (true)
            {
                Socket socket = null;
                cloud.cloudnet.socketslist.TryDequeue(out socket);
                if (socket != null)
                {
                    byte[] buf = new byte[1024 * 1024];

                    socket.Receive(buf);
                    Package package = IoT_Net.BytesToPackage(buf);

                    if (package.message == Messagetype.codeus)
                    {
                        PointCloudUserC userC = new PointCloudUserC(socket, package, cc, m);
                        UserC.Add(userC);

                        IPList iP = new IPList();
                        iP.ID = userC.ID;
                        iP.IP = socket.RemoteEndPoint.ToString();
                        cloud.IPmanager("Add", "UserList", iP);
                    }
                    else
                    {
                        if (package.message == Messagetype.ID)
                        {
                            PointCloudDeviceC deviceC = new PointCloudDeviceC(socket, package, m);
                            DeviceC.Add(deviceC);

                            IPList iP = new IPList();
                            iP.ID = deviceC.ID;
                            iP.IP = socket.RemoteEndPoint.ToString();
                            cloud.IPmanager("Add", "DeviceList", iP);
                        }
                    }
                    m.SimulateNewIPLEvent(cloud.DeviceList);
                }
                Thread.Sleep(100);
            }
        }
Beispiel #5
0
 void TODO(PointCloudDeviceC Device, Codemode codemode)
 {
     Device.SendCode(codemode);
 }