/// <summary> /// 关闭LED /// </summary> public static void CloseLED() { try { //删除动态区域 int err = YB19DynamicAreaLeder.SCREEN_DelDynamicArea(m_dwCurHand, 1, new byte[] { AreaID }); //销毁通讯 YB19DynamicAreaLeder.Destroy(m_dwCurHand); //卸载SDK YB19DynamicAreaLeder.ReleaseSdk(); } catch { } }
/// <summary> /// 打开LED设备 /// </summary> /// <param name="ip"></param> /// <param name="areaID"></param> /// <returns></returns> public static bool OpenLED(string ip, byte areaID) { try { AreaID = areaID; YB19DynamicAreaLeder.InitSdk(2, 2); byte[] broad_ip = System.Text.Encoding.ASCII.GetBytes(ip); m_dwCurHand = YB19DynamicAreaLeder.CreateClient(broad_ip, (uint)5005, YB19DynamicAreaLeder.bx_5k_card_type.BX_6E1X, 2, 0, null); return(m_dwCurHand != 0); } catch { return(false); } }
/// <summary> /// 更新LED信息 /// </summary> /// <param name="str"></param> public static bool UpdateLED(string str) { uint pDynamic = YB19DynamicAreaLeder.CON_CreateDynamic(); uint pbmpbyte = YB19DynamicAreaLeder.CON_CreateImgToByte((ColorType)0, (MatrixType)0, (BX_Screen)1); //创建动态区域 uint hArea = YB19DynamicAreaLeder.CON_CreateDynamicArea(pbmpbyte, AreaID, 0, 1, 1, 0, new ushort[] { }, 1, 0, 0, 96, 32, 0); //添加图文到区域 //YB19DynamicAreaLeder.CON_DynamicAreaAddStrPage(hArea, 1, 0, 200, Encoding.Unicode.GetBytes(str), Encoding.Unicode.GetBytes("宋体"), 12, 0xffff0000, false, false, false, 0, false); YB19DynamicAreaLeder.CON_DynamicAreaAddStrPage(hArea, 1, 0, 200, Encoding.Unicode.GetBytes(str), Encoding.Unicode.GetBytes("宋体"), 12, 0xffff0000, 0xff000000, false, false, false, 1, false); //关联区域 YB19DynamicAreaLeder.CON_DynamicArea(pDynamic, hArea); //更新区域 int err = YB19DynamicAreaLeder.CON_SendDynamic(m_dwCurHand, pDynamic, pbmpbyte); //销毁区域 YB19DynamicAreaLeder.CON_DestroyDynamic(pDynamic); return(err == 0); }