Ejemplo n.º 1
0
        /// <summary>
        /// 更新动态区域
        /// </summary>
        /// <param name="value1"></param>
        /// <param name="value2"></param>
        /// <returns></returns>
        public bool UpdateArea(string value1, string value2 = "")
        {
            if (!this.ConnectStatus)
            {
                return(false);
            }
            string value = value1 + value2;

            Led5kSDK.bx_5k_area_header bx_5k = new Led5kSDK.bx_5k_area_header();
            bx_5k.AreaType    = 0x06;
            bx_5k.AreaX       = 0;
            bx_5k.AreaY       = 0;
            bx_5k.AreaWidth   = 96 / 8;
            bx_5k.AreaHeight  = 32;
            bx_5k.Lines_sizes = 1; //行间距
            bx_5k.RunMode     = 0; //运行模式 0自动循环显示 1完成后停留在最后一页 2超时未完成删除该信息
            bx_5k.Timeout     = 2; //超时时间 秒

            bx_5k.Reserved1   = 0;
            bx_5k.Reserved2   = 0;
            bx_5k.Reserved3   = 0;
            bx_5k.SingleLine  = 0x02;
            bx_5k.NewLine     = 0x02;//自动换行
            bx_5k.DisplayMode = 0x01;
            bx_5k.ExitMode    = 0x00;
            bx_5k.Speed       = 1;

            byte[] AreaText = System.Text.Encoding.Default.GetBytes(value);
            bx_5k.DataLen = AreaText.Length;

            int x = Led5kSDK.SCREEN_SendDynamicArea(m_dwCurHand, bx_5k, (ushort)bx_5k.DataLen, AreaText);

            return(x == 0);
        }
Ejemplo n.º 2
0
        public int SendAreas(uint hand)
        {
            byte[] AreaText;
            int    TextLen;
            byte   AreaNum = 0;

            int sum = 0;

            foreach (LedstaticArea s in m_arealist)
            {
                sum += s.getAreaLen();
                AreaNum++;
            }
            AreaText = new byte[sum];
            int index = 0;

            foreach (LedstaticArea s in m_arealist)
            {
                byte[] bt = s.AreaToByteArray();
                bt.CopyTo(AreaText, index);
                index += bt.Length;
            }
            TextLen = sum;
            return(Led5kSDK.SCREEN_SendDynamicAreas(hand, AreaNum, (ushort)TextLen, AreaText));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 创建连接
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <returns></returns>
        public bool CreateListent(string ip, int port = 5005)
        {
            byte[] led_ip   = System.Text.Encoding.ASCII.GetBytes(ip);
            uint   led_port = Convert.ToUInt32(port);

            uint hand = Led5kSDK.CreateClient(led_ip, led_port, Led5kSDK.bx_5k_card_type.BX_5K1, 1, 1, null);

            m_dwCurHand = hand;
            if (hand == 0)
            {
                SetStatus(false);
                return(false);
            }
            else
            {
                SetStatus(true);
                return(true);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 断开连接
 /// </summary>
 public void CloseListent()
 {
     UpdateArea("  停止过磅");
     Led5kSDK.Destroy(m_dwCurHand);
     SetStatus(false);
 }
Ejemplo n.º 5
0
 public YB_Bx5K1()
 {
     Led5kSDK.InitSdk(2, 2);
 }
Ejemplo n.º 6
0
        public int SendProgram(uint hand)
        {
            byte[] ppFileName;
            byte[] ProgramLife;
            byte   PlayPeriodGrpNum;

            byte[] Period;
            byte[] AreaDataList;
            int    AreaDataListLen;

            int sum = 0;

            foreach (Led5kstaticArea s in m_arealist)
            {
                sum += s.getAreaLen();
            }
            AreaDataList = new byte[sum];
            int index = 0;

            foreach (Led5kstaticArea s in m_arealist)
            {
                byte[] bt = s.AreaToByteArray();
                bt.CopyTo(AreaDataList, index);
                index += bt.Length;
            }
            AreaDataListLen = sum;
            if (IsValidAlways == true)
            {
                ProgramLife    = new byte[8];
                ProgramLife[0] = 0xff;
                ProgramLife[1] = 0xff;
                ProgramLife[2] = 0xff;
                ProgramLife[3] = 0xff;
                ProgramLife[4] = 0xff;
                ProgramLife[5] = 0xff;
                ProgramLife[6] = 0xff;
                ProgramLife[7] = 0xff;
            }
            else
            {
                ProgramLife = new byte[8];
                byte[] tmp = Led5kProgram.short2bcd(StartYear);
                ProgramLife[0] = tmp[0];
                ProgramLife[1] = tmp[1];
                ProgramLife[2] = byte2bcd(StartMonth);
                ProgramLife[3] = byte2bcd(StartDay);

                byte[] tmp1 = Led5kProgram.short2bcd(EndYear);

                ProgramLife[4] = tmp1[0];
                ProgramLife[5] = tmp1[1];
                ProgramLife[6] = byte2bcd(EndMonth);
                ProgramLife[7] = byte2bcd(EndDay);
            }


            ppFileName = System.Text.Encoding.Default.GetBytes(name);

            if (IsPlayOnTime == true)
            {
                Period    = new byte[7];
                Period[0] = byte2bcd(StartHour);
                Period[1] = byte2bcd(StartMinute);
                Period[2] = byte2bcd(StartSecond);
                Period[3] = byte2bcd(EndHour);
                Period[4] = byte2bcd(EndMinute);
                Period[5] = byte2bcd(EndSecond);
                Period[6] = 0;
            }
            else
            {
                Period = null;
            }

            PlayPeriodGrpNum = Convert.ToByte(IsPlayOnTime ? 1 : 0);

            return(Led5kSDK.OFS_SendFileData(hand, 1, ppFileName, DisplayType, PlayTimes, ProgramLife,
                                             ProgramWeek, PlayPeriodGrpNum, Period, AreaNum, AreaDataList, AreaDataListLen));
        }