public void SendCmd(string asrvId, string cmdType)
        {
            InitParameter(asrvId);

            ZIGBEE z=new ZIGBEE();
            byte[] sendBuffer = z.GetSendData(GetCmdAllData(cmdType),MACADDRESS);

            TcpClient tcp = new TcpClient();

            tcp.Connect(IPADRESS,PORT);

            if (tcp.Connected)
            {
                NetworkStream ns = tcp.GetStream();
                ns.Write(sendBuffer,0,sendBuffer.Length);

                ns.Close();
                tcp.Close();
            }



        }
예제 #2
0
        public bool RouteBreak()
        {
            DataSet ds = GetTask();
            //没有路径则返回
            if (ds == null || ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)
                return false;


            ArrayList points = BuildRouteBreak(ds);

            byte[] data = GetTaskCmd(GetActionBytes(points));
            byte[] mac = GetMacAdress();

            ZIGBEE z = new ZIGBEE();

            byte[] buffer = z.GetSendData(data, mac);


            try
            {
                InsertCmdBreakdown(buffer, "TASK");
                return true;
            }
            catch
            {
                return false;
            }




        }