import win.ui;
/*DSG{{*/
mainForm = win.form(text="仰邦LED";right=757;bottom=467;)
mainForm.add(
button={cls="button";text="发送节目";left=70;top=40;right=161;bottom=72;z=1;};
button2={cls="button";text="开机";left=63;top=306;right=154;bottom=338;z=2;};
button3={cls="button";text="关机";left=183;top=306;right=274;bottom=338;z=3;};
)
/*}}*/
import raw;
import string
led = ..raw.loadDll("\res\bx_sdk_dual.dll");
//初始化LED
led.bxDual_InitSdk()
//发送动态数据到控制器
class EQSound_6G {
byte SoundFlag = 0;
byte SoundPerson = 1;
byte SoundVolum;
byte SoundSpeed;
byte SoundDataMode;
int SoundReplayTimes;
int SoundReplayDelay;
byte SoundReservedParaLen;
byte Soundnumdeal;
byte Soundlanguages;
byte Soundwordstyle;
int SoundDataLen;
pointer SoundData;
}
class EQareaHeader_G6 { //区域属性
byte AreaType = 0; //区域类型
word AreaX = 0; //左上角
word AreaY = 0; //右
word AreaWidth = 96; //宽
word AreaHeight = 16; //高
byte BackGroundFlag = 0;
byte Transparency = 101;
byte AreaEqual = 0;
struct stSoundData = ..EQSound_6G();
}
class EQpageHeader_G6 { //显示属性
byte PageStyle = 0; //数据页类型
byte DisplayMode = 1; //显示方式
byte ClearMode = 0; //退出方式
byte Speed = 10; //速度等级1-64 1最快
word StayTime = 500; //停留秒
byte RepeatTime = 1;
word ValidLen = 96; //有效宽度
byte CartoonFrameRate=0;
byte BackNotValidFlag=0;
int arrMode = 1; //1为单行 2为多行
word fontSize = 12; //字体大小
int color = 1; //颜色
byte fontBold = 0;
byte fontItalic = 0;
word tdirection = 1;
word txtSpace = 0;
byte Valign = 0;
byte Halign = 0;
}
import console;
//UFT8 为65001 GBK 为936
mainForm.button.oncommand = function(id, event) {
// var text = "光庆你好 ";
var font = "宋体";
var color = 1; //1单基色 2 双基色
var ProgramID = 0; //默认从0开始
var EQareaHeader = EQareaHeader_G6(); //区域
var EQpageHeader = EQpageHeader_G6(); //显示内容
console.varDump(EQareaHeader,EQpageHeader)
var ret = led.bxDual_program_addArea_G6(ProgramID, EQareaHeader)
console.log(ret, "创建分区")
//var text = string.fromto("光庆你好 ", 65001, 936);
//var aa = raw.buffer("hello word AreaY");
// var fontb =raw.buffer("宋体");
//这条函数闪通
var ret = led.bxDual_dynamicArea_AddAreaTxtDetails_6G("192.168.1.4", 5005, ProgramID, EQareaHeader, EQpageHeader,"宋体", "hello word AreaY")
console.log(ret, "发送内容")
}
mainForm.button2.oncommand = function(id,event){
//开机
var ret =led.bxDual_cmd_coerceOnOff("192.168.1.4",5005,1)
console.log(ret)
}
mainForm.button3.oncommand = function(id,event){
//关机
var ret =led.bxDual_cmd_coerceOnOff("192.168.1.4",5005,0)
console.log(ret)
}
mainForm.show();
return win.loopMessage();