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; }
// byte g_code_id; public RGS_PolygonData(RGS_Ploygon[] polygons) { // this.g_code_id = g_code_id; this.polygons = polygons; }