예제 #1
0
        //public Color[][] getBackGroundPic(string ip, int port, int mode, int g_code_id, ref string desc)
        //{
        //   // throw new Exception("The method or operation is not implemented.");
        //    try
        //    {
        //        Comm.TC.RGSTC tc = (Comm.TC.RGSTC)this.getMFCC_base().getTcManager()[ip,port];
        //        checkAllowConnect(tc);
        //        return Util.BitMapToColors(tc.TC_GetBackgroundPic(0xffff, (byte)mode, (byte)g_code_id, ref desc));
        //       // ((Comm.TC.RGSTC)tc).(0xffff,mode,g_code_id,
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new RemoteInterface.RemoteException(ex.Message);
        //    }
        //}
        public void setPolygonData(string devName, byte g_code_id,RGS_PolygonData pdata)
        {
            try
               {
               Comm.TC.RGSTC tc = (Comm.TC.RGSTC)this.getMFCC_base().getTcManager()[devName];
               this.checkAllowConnect(tc);
               tc.TC_SetPolygon(0xffff, g_code_id, pdata);

               }
               catch (Exception ex)
               {
               throw new RemoteInterface.RemoteException(ex.Message+","+ex.StackTrace);
               }
        }
예제 #2
0
        public static RGS_PolygonData RGS_getPolygons(I_DLE device, int address, byte g_code_id)
        {
            RGS_PolygonData polygonData;

            byte[] cmdtext = new byte[] {0x9b,g_code_id };

            SendPackage pkg = new SendPackage(CmdType.CmdQuery, CmdClass.A, address, cmdtext);
            device.Send(pkg);
            if (pkg.result != CmdResult.ACK)
                throw new Exception(pkg.result.ToString());
            byte[] retText = pkg.ReturnTextPackage.Text;
            int inx = 1;
            if (retText[inx++] != g_code_id)
                throw new Exception(" g_code_id is wrong !");

            RGS_Ploygon []polygons=new RGS_Ploygon[retText[inx++]];
              //  sec_id = retText[inx++];
            for (int i = 0; i < polygons.Length; i++)
            {
                polygons[i] = new RGS_Ploygon(retText[inx++]); //no points
                for (int j = 0; j < polygons[i].points.Length; j++)
                {
                    polygons[i].points[j].X = retText[inx++] * 256;
                    polygons[i].points[j].X += retText[inx++];
                    polygons[i].points[j].Y = retText[inx++] * 256;
                    polygons[i].points[j].Y += retText[inx++];
                }
            }

            polygonData = new RGS_PolygonData(polygons);

            return polygonData;
        }
예제 #3
0
        public static void RGS_setPolygons(I_DLE device, int address, byte g_code_id, RGS_PolygonData polygonData)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            ms.WriteByte(0x9a);
            ms.WriteByte(g_code_id);
            ms.WriteByte((byte)polygonData.polygons.Length);//section_count

            for (byte section_id = 1; section_id <= polygonData.polygons.Length; section_id++)
            {
                ms.WriteByte(section_id);//section_id
                ms.WriteByte((byte)polygonData.polygons[section_id - 1].points.Length);//length
                for (int point_inx = 0; point_inx < polygonData.polygons[section_id - 1].points.Length; point_inx++)
                {
                    ms.WriteByte((byte)(polygonData.polygons[section_id - 1].points[point_inx].X / 256));
                    ms.WriteByte((byte)(polygonData.polygons[section_id - 1].points[point_inx].X % 256));
                    ms.WriteByte((byte)(polygonData.polygons[section_id - 1].points[point_inx].Y / 256));
                    ms.WriteByte((byte)(polygonData.polygons[section_id - 1].points[point_inx].Y % 256));
                }
            }

             byte[]text=new byte[ms.Position];
             System.Array.Copy(ms.GetBuffer(),text,ms.Position);

             SendPackage pkg = new SendPackage(CmdType.CmdSet, CmdClass.A, address, text);
             device.Send(pkg);
        }
예제 #4
0
파일: RGSTC.cs 프로젝트: ufjl0683/Center
 public void TC_SetPolygon(int address, byte g_code_id, RGS_PolygonData pdata)
 {
     checkConntected();
     RGS30_Extend.RGS_setPolygons(this.m_device, address, g_code_id, pdata);
 }