TOOLS

 ⚡http Call Box SDK:

http browse Box IP(2.0.0.44) and take cmd, like this: http://2.0.0.44/cmd?xxxx ➽ xxxx is function command
command is string, and not include spaces char.

 http Play offline dmx file, command:
pall: Play offline playlist file (You need to make a playlist file first, In webui Offline page, it is easy to create playlist files by dragging and dropping the file name)
stop: Stop offline playing
play=filename : Play a offline dmx filename
loop=xxxx: Set offline loop number, max=65535
Example:
1: Play playlist file: http://2.0.0.44/cmd?pall    ➽    
2: Stop playing dmx file: http://2.0.0.44/cmd?stop    ➽    
3: Play a dmx file: http://2.0.0.44/cmd?play=filename    ➽    (Note: filename can't contain spaces char, it is UTF8 encode, and can support Chinese )
4: Set loop number: http://2.0.0.44/cmd?loop=1024    ➽    


 http Play LED Effect:
Command like this: http://2.0.0.44/cmd?eff=eff_cmd%arg ➽ eff_cmd is effect function command, arg is value for eff_cmd

play: Play effect of index number ➼ http://2.0.0.44/cmd?eff=playXX    ➽    
XX = 0-53, effect index number
Play effect 9 : http://2.0.0.44/cmd?eff=play9
Play effect 32 : http://2.0.0.44/cmd?eff=play32

pall : Auto Play all effect ➼ http://2.0.0.44/cmd?eff=pall    ➽    

stop : Stop Playing effect ➼ http://2.0.0.44/cmd?eff=stop    ➽    

brig: Set Brightness ➼ http://2.0.0.44/cmd?eff=brigXXX    ➽    
XXX = 0-255
Set Brightness to 252 : http://2.0.0.44/cmd?eff=brig252
Set Brightness to 90 : http://2.0.0.44/cmd?eff=brig90

sped: Set Speed ➼ http://2.0.0.44/cmd?eff=spedXXX    ➽    
XXX = 0-255
Set Speed to 220 : http://2.0.0.44/cmd?eff=sped220

rgb: Set RGB Color ➼ http://2.0.0.44/cmd?eff=rgb%R%G%B    ➽    
R = 0-255
G = 0-255
B = 0-255
Set RGB(78,129,250): http://2.0.0.44/cmd?eff=rgb%78%129%250

rgbw: Set RGBW Color ➼ http://2.0.0.44/cmd?eff=rgbw%R%G%B%W    ➽    
R = 0-255
G = 0-255
B = 0-255
W = 0-255
Set RGBW(210,70,20,255): http://2.0.0.44/cmd?eff=rgbw%210%70%20%255

flag: Set LED Strip is RGB or RGBW flag ➼ http://2.0.0.44/cmd?eff=flagX    ➽    
X = 0 LED Strip is RGB (3 channels)
X = 1 LED Strip is RGBW (4 channels)
Set LED Strip to RGBW: http://2.0.0.44/cmd?eff=flag1
Set LED Strip to RGB : http://2.0.0.44/cmd?eff=flag0 / (default is RGB)

dire: Set Run Direction ➼ http://2.0.0.44/cmd?eff=direX    ➽    
X = 0 Normal run
X = 1 Invert run
Set LED invert run: http://2.0.0.44/cmd?eff=dire1
Set LED normal run: http://2.0.0.44/cmd?eff=dire0 / (default is normal run)

outp: Set effect out to this Port ➼ http://2.0.0.44/cmd?eff=outpX    ➽    
Note: LED effect default out to PORT0(fixed), if want out to other PORT1-3, must set to port bit.
X = PORT1-3 bit flag, 0b111=PORT3,PORT2,PORT1 / (0b111)=7 All PORT, (0b0100)=4 PORT3, (0b011)=3 PORT2 PORT1, (0b010)=2 PORT2, (0b001)=1 PORT1, (0b000)=0 close PORT0-3, not out set bit=0
Set LED effect out to all PORT: http://2.0.0.44/cmd?eff=outp7 / (default is to all PORT)
Set LED effect out to PORT2, PORT1: http://2.0.0.44/cmd?eff=outp3 / (Note: LED effect default out to PORT0, so out3 = effect out to PORT0, PORT1, PORT2)

patc: Set RGB fixture lib Patch ➼ http://2.0.0.44/cmd?eff=patcX    ➽    
X = 0-5 / RGB=0 RBG=1 GBR=2 GRB=3 BRG=4 BGR=5
LED Strip is GBR: http://2.0.0.44/cmd?eff=patc2
LED Strip is RBG: http://2.0.0.44/cmd?eff=patc1
LED Strip is RGB: http://2.0.0.44/cmd?eff=patc0 ( Note: default is RGB )

leng: Set Led pixel length ➼ http://2.0.0.44/cmd?eff=lengXXX    ➽    
XXX = 0-170 / one segment led pixels, RGB max=170, RGBW max=128
Set LED one segment have 64 pixels: http://2.0.0.44/cmd?eff=leng64
Note: one 512 channels can link RGB 170 pixels, if one segment set 64 pixels, Box will auto make 170/64=2 segment, and last 42 pixels as one segment, total 3 segment, each segment effect is same.

time: Set Effect Run time ➼ http://2.0.0.44/cmd?eff=timeXXXXX    ➽    
XXXX = 0-65535 / Run Time = XXXX/2 second
Set Effect Run time 30s: http://2.0.0.44/cmd?eff=time60

clra: Clear Off All LED ➼ http://2.0.0.44/cmd?eff=clra    ➽    


 http Reboot Box:
Command is fixed, like this:    ➽    

 ⚡UDP Call Box SDK:

Send UDP Packet to IP=Box IP(2.0.0.44) or Broadcast(2.0.0.255) / Destination Port: 0x1975(6517)
struct RAW_Pack {
   BYTE id[9]; //Hahan123
   BYTE non;
   BYTE cmd_L; //C0(Send 512 channels dmx data to box), CA(set all dmx to this value), CC(set one channel value), C7(play LED effect), '@'(play offline DMX file)
   BYTE cmd_H; //always=00
   WORD portnum; //portnum = net*256 + subnet*16 + universe / portnum=0xFFFF send to all port, not check universe
   WORD length_channel_add; //2BYTE DMX512 data Len or channel address
   BYTE value; //1BYTE DMX Value
   BYTE tmp; //1BYTE
   BYTE dmxdata_val_start; //1BYTE dmx data start
}; //C language structures, byte order is in little-endian mode (high bytes are stored high address in memory)
Head(HEX): 48 61 68 61 6E 31 32 33 00 non cmd_L cmd_H sub_universe net xx xx xx ...
Mean:     "Hahan123" non cmdL cmdH Universe Net ...


 UDP Send one universe 512 channels dmx data(packet len=530byte with 512byte DMX data):
UDP cmd = C0 / send 512 channels dmxdata to universe port / (HEX): 48 61 68 61 6E 31 32 33 00 FF C0 00 sub_universe net 00(Len_L) 02(Len_H) 00 00 dmx[0]...dmx[511] / ( net=0-127 sub_universe=0-255(universe) )


 UDP Set one universe to all this dmx value(packet=17byte, net/sub_universe=0xFFFF will send to all port, not check universe):
UDP cmd = CA / Set all 512 channels to this value / (HEX): 48 61 68 61 6E 31 32 33 00 FF CA 00 sub_universe net 00 00 value (value=0-255)


 UDP Set universe one channel to this dmx value(packet=17byte):
UDP cmd = CC / like dmx[address]=value / (HEX): 48 61 68 61 6E 31 32 33 00 FF CC 00 sub_universe net channel_add_L channel_add_H value / ( dmx[channel_add]=value )


 UDP Call LED effect function:
UDP cmd C7 / (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 sub_universe net eff_cmd value / eff_cmd=0x44, 0xA0...AC (net/sub_universe=0xFFFF don't check box universe)

A0: Set effect config (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 sub_universe net A0 rgbw patch led_pixel_len port invert
rgbw: RGB=0, RGBW=1
patch: RGB=0 RBG=1 GBR=2 GRB=3 BRG=4 BGR=5
led_pixel_len: one segment led pixel len, RGB max=170, RGBW max=128
port: led effect default out to PORT0(fixed), if want out to other port, must set to port bit, 0b111=PORT3,PORT2,PORT1, =7 all PORT, =4 PORT3, =3 PORT2 PORT1, =2 PORT2, =1 PORT1
invert: LED run direction, normal=0, invert=1

A1: Play effect (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A1 effect_index
effect_index = 0-53 (have 54 number effect) / effect_index = 0xFA auto play all
A1:Auto Play all effect (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A1 FA
effect_index = 0xFA (Auto Play all effect)

44: Stop Play (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF 44

A2: Set Brightness (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A2 Brightness
Brightness = 0-255 (HEX: 00-FF)

A3: Set Speed (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A3 Speed
Speed = 0-255 (HEX: 00-FF)

A4: Set RGB Color (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A4 R G B
R = 0-255 (HEX: 00-FF)
G = 0-255 (HEX: 00-FF)
B = 0-255 (HEX: 00-FF)

A5: Set RGBW Color (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A5 R G B W
R = 0-255 (HEX: 00-FF)
G = 0-255 (HEX: 00-FF)
B = 0-255 (HEX: 00-FF)
W = 0-255 (HEX: 00-FF)

A6: Set LED RGBW flag (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A6 flag
flag = 0 LED Strip is RGB (3 channels)
flag = 1 LED Strip is RGBW (4 channels)

A7: Set Run Direction (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A7 Invert
Invert = 0 Normal run
Invert = 1 Invert run

A8: Set effect out to this Port (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A8 port
port: 0b111=PORT2,PORT1,PORT0 / =7 All PORT2,1,0, =6 PORT2 PORT1, =5 PORT2 PORT0, =4 PORT2, =3 PORT1 PORT0, =2 PORT1, =1 PORT0(default out)

A9: Set RGB Patch (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF A9 Patch
patch: RGB=0 RBG=1 GBR=2 GRB=3 BRG=4 BGR=5

AA: Set Led pixel len (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF AA len
len: one segment led pixels, RGB max=170, RGBW max=128

AB: Set Run time (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF AB time_L time_H
Run time = (time_H * 256 + time_L)/2 Second

AC: Off All LED (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF AC

B0: For one Channel auto FADE (HEX): 48 61 68 61 6E 31 32 33 00 FF C7 00 FF FF B0 PORT Channel_L Channel_H Fade_Time Gap_Value End_Value CC(Fixed value)
PORT: 0,1,2,3 / 4(will out all PORT0,1,2,3), this value not above 4
Channel_L: 0~255
Channel_H: 0 or 1, if channels above 255, then this value is 1, DMX Channel(0~511)=Channel_H*256+Channel_L
Fade_Time: 25ms~255ms, Every this time, FADE will be change once, don't below 25
Gap_Value: 1~255, the value of the FADE increases or decreases each Fade_Time, It is recommended that this value should not be greater than 20
End_Value: 0~255, FADE to this value will stop
Fixed value: CC
Pleae Note: that whether the FADE increases or decreases depends on the original DMX value, if the original value is greater than the End_Value, the FADE will decrease, if it is less than, the FADE will increase.


 UDP Call offline DMX file function (TF card must insert box at power on):
UDP cmd is ASCII string / Packet String Struct: Hahan123?=@ cmd arg
cmd: 'p' or 'P' play file
cmd: 's' or 'S' Stop play
cmd: 'a' or 'A' Auto play playlist file (Note: 'A' will play from the first dmx file, 'a' will continue play from the last stop dmx file)
cmd: 'l' or 'L' Set loop value, loop max=65535

Example (UDP send this string to Box IP(2.0.0.44) or Broadcast(2.0.0.255) / Destination Port: 0x1975(6517)):
Play "demo.dmx" file: Hahan123?=@Pdemo.dmx
Play playlist file at default loop: Hahan123?=@A
Play playlist file at loop 100: Hahan123?=@A100
Set loop value to 1234: Hahan123?=@L1234
Clear loop: Hahan123?=@L0
Stop play: Hahan123?=@S


 UDP Check Box is it online:
UDP cmd is ASCII string / Packet String: Hahan123?=HELLO
Send UDP Packet to IP=Box IP(2.0.0.44) or Broadcast(2.0.0.255) / Source Port: 0x1A85(6789), Destination Port: 0x1975(6517)
Box will return ASCII string "OK=your box ip", like: OK=2.0.0.44

Example:
UDP send string to: Broadcast IP=2.0.0.255, Source Port: 0x1A85(6789), Destination Port: 0x1975(6517), String: Hahan123?=HELLO
You will get string: OK=2.0.0.44, if get OK=... then can check box is online, if have many box connected LAN, then will find all box.


 UDP Reboot Box :
UDP cmd is ASCII string / Packet String: Hahan123?=REBOOT
Send UDP Packet to IP=Box IP(2.0.0.44) or Broadcast(2.0.0.255), Destination Port: 0x1975(6517), Box will Reboot

Example:
UDP send string to: Broadcast IP=2.0.0.255, Destination Port: 0x1975(6517), String: Hahan123?=REBOOT
All in 2.x.x.x network segment box will reboot, if IP=2.0.0.44, only this 2.0.0.44 box will reboot.

 ⚡RS485 Call box SDK (PORT3 set to DMXIn and Enable RS485_call, if want RS232 call box, need add a RS232->RS485 hardware module):

RS485 Packet Struct: cmd port arg0 arg1 ...
cmd: C0 - C7 and '@'
port: 0,1,2 / 3(will out all PORT0,1,2), this value not above 3, PORT3 for RS485 hardware interface
arg: for any cmd need value

C0: Set PORT 512 channels all to this dmx value, (HEX): C0 PORT value
Set PORT0 all 512 channel to 255: C0 00 FF
Clear PORT1 all 512 channel to 0: C0 01 00
Set PORT0,1,2 all 512 channel to 128: C0 03 80 (if PORT set to 03, dmx value will out all PORT, PORT0,1,2 all value is same)


C1: Set PORT low 256 channels address to this dmx value, (HEX): C1 PORT Low_add value / ( Note: address count starts at 0, not from 1 )
Set PORT2 220 channel to 178: C1 02 219 178 (Please note: channel address 219 is 220-1, 219 and 178 need change to HEX)
Set PORT0 16 channel to 255: C1 00 15 255
Set PORT0,1,2 all 47 channel to 128: C1 03 47 128 (if PORT set to 03, dmx value will out all PORT, Please note: 47 and 128 need change to HEX)


C2: Set PORT High 256 channels address to this dmx value, (HEX): C2 PORT High_add value / ( Note: High_add value is 0-255, but box will auto add 256, so channel address will change to 256-511 )
Set PORT1 301 channel to 100: C2 01 44 100 / ( dmx address starts at 0, so dmx address 301 in box is 300, 44=300-256 )
Set PORT0 512 channel to 200: C2 00 255 200 /( address=512, in box is 511, 255=511-256(auto add) )


C3(Low_add)/C4(High_add): Fixture Move to X, Y point, (HEX): C3/C4 PORT ChX_add, X_value, ChY_add, Y_value / ( Note: C4 is High_add, box will auto add 256 )
For Example: PORT0 have a Moving head, address set to 1, channel 3 is Pan, channel 5 is Tilt
fixture Move to X=127, Y=200 point: C3 00 02 127 04 200 / [ Note: address count starts at 0, not from 1, C3(cmd) 00(PORT0) 02(X channel add 3-1) 127(X value) 04(Y channel add 5-1) 200(Y value) ]
if this fixture address set to 288, Move to X=64, Y=251 point, High_add use C4: C4 00 (288-256+02) 64 (288-256+04) 251


C5(Low_add)/C6(High_add): PUSH PORT Low_High_add ch1 ch2 ch3 ...., (HEX): C5/C6 PORT Low_High_add, ch1 ch2 ch3 ... / ( Note: C6 is High_add, box will auto add 256 )
PORT1 have two Moving head, address set to 16 and 48, this fixture have 20 channels, now set those two fixture:
C5 01(PORT1) 15(address) ch1_dmx_value ch2_dmx_value ... ch20_dmx_value / ( Note: address count starts at 0, address 16 is 15 )
C5 01(PORT1) 47(address) ch1_dmx_value ch2_dmx_value ... ch20_dmx_value / ( Note: ch number max=99 ch1...ch99, don't above 99 )


 C7: Call LED effect function (HEX): C7 eff_cmd arg / ( Note: eff_cmd=0x44, 0xA0...AC, like UDP cmd=C7, only not include UDP head bytes )

A1: Play effect (HEX): C7 A1 effect_index
effect_index: 0~53 or 0xFA(Auto Play All)
Play effect 9 (HEX): C7 A1 09
Auto Play all effect (HEX): C7 A1 FA

44: Stop Play effect (HEX): C7 44

A2: Set Brightness (HEX): C7 A2 Brightness
Brightness = 0-255 (HEX: 00-FF)

A3: Set Speed (HEX): C7 A3 Speed
Speed = 0-255 (HEX: 00-FF)

A4: Set RGB Color (HEX): C7 A4 R G B
R = 0-255 (HEX: 00-FF)
G = 0-255 (HEX: 00-FF)
B = 0-255 (HEX: 00-FF)

A5: Set RGBW Color (HEX): C7 A5 R G B W
R = 0-255 (HEX: 00-FF)
G = 0-255 (HEX: 00-FF)
B = 0-255 (HEX: 00-FF)
W = 0-255 (HEX: 00-FF)

A6: Set LED RGBW flag (HEX): C7 A6 flag
flag = 0 LED Strip is RGB (3 channels)
flag = 1 LED Strip is RGBW (4 channels)

A7: Set Run Direction (HEX): C7 A7 Invert
Invert = 0 Normal run
Invert = 1 Invert run

A8: Set effect out to this Port (HEX): C7 A8 port
port: 0b111=PORT2,PORT1,PORT0 / =7 All PORT2,1,0, =6 PORT2 PORT1, =5 PORT2 PORT0, =4 PORT2, =3 PORT1 PORT0, =2 PORT1, =1 PORT0(default out)

A9: Set RGB Patch (HEX): C7 A9 Patch
patch: RGB=0 RBG=1 GBR=2 GRB=3 BRG=4 BGR=5

AA: Set Led pixel len (HEX): C7 AA len
len: one segment led pixels, RGB max=170, RGBW max=128

AB: Set Run time (HEX): C7 AB time_L time_H
Run time = (time_H * 256 + time_L)/2 Second

AC: Off All LED (HEX): C7 AC

B0: For one Channel auto FADE in / out (HEX): C7 B0 PORT Channel_L Channel_H Fade_Time Gap_Value End_Value
PORT: 0,1,2 / 3(will out all PORT0,1,2), this value not above 3, PORT3 for RS485 hardware interface
Channel_L: 0~255
Channel_H: 0 or 1, if channels above 255, then this value is 1, DMX Channel(0~511)=Channel_H*256+Channel_L
Fade_Time: 25ms~255ms, Every this time, FADE will be change once, don't below 25
Gap_Value: 1~255, the value of the FADE increases or decreases each Fade_Time, It is recommended that this value should not be greater than 20
End_Value: 0~255, FADE to this value will stop
Pleae Note: that whether the FADE increases or decreases depends on the original DMX value, if the original value is greater than the End_Value, the FADE will decrease, if it is less than, the FADE will increase.


 RS485 Call offline DMX file function (TF card must insert box at power on):
RS485 cmd is ASCII string: @ cmd arg
cmd: 'p' or 'P' play file
cmd: 's' or 'S' Stop play
cmd: 'a' or 'A' Auto play playlist file (Note: 'A' will play from the first dmx file, 'a' will continue play from the last stop dmx file)
cmd: 'l' or 'L' Set loop value, loop max=65535

Example:
Play "Test123.dmx" file: @pTest123.dmx
Play playlist file at default loop: @A
Play playlist file at loop 20: @A20
Set loop value to 77: @L77
Clear loop: @L0
Stop play: @S


 RS485 Call Reboot Box:
RS485 cmd is ASCII string: @reboot
When RS485 send this string "@reboot" to Box, Box will reboot.

 ⚡DMXin / DMXout call offline dmx file :

How to do ?
1: You need to make a offline playlist file first, In box Offline page, it is easy to create playlist files by dragging and dropping the file name.
2: In BoxSetup page you can change PORT3 to DMXin mode and enable DMXin->Offline or enable DMXout->Offline, You can only choose 1 of 2 between DMXin->Offline and DMXout->Offline function, and set Box DMXAddress to you want, that mean SL04 Box like a lighting fixture.
3: In Offline page make a dmx playlist file and disable AutoPlay.
4: SL04 Box like a lighting fixture, have 3 channels, channels mean:
CH1: value 0-9 Stop, 10-249 Play a dmx file from playlist index with loop, 250-255 loop Play All playlist file.
CH2: value 0-255 = dmx file index in playlist, max 256 files.
CH3: value 0-255 = loop number

About DMXout->Offline: DMXout->Offline like DMXin->Offline, DMXin->Offline used hardware PORT3 interface get dmx data, DMXout->Offline not use box hardware PORT, it's used Artnet universe software PORT get dmx data, support by any software and consoler out Artnet dmx data to call TF card offline dmx files, when enable this function, SL04 box will add one artnet PORT for DMXout offline, now box have 5 Artnet PORT.

For Example:
1: If box dmx address set=1, You want play dmx file in playlist index=3, loop 5 times:
 In your dmx consoler, patch 3 channels fixture light library to dmx address=1, then channel3 push to 5, channel2 push to 3, channel1 push to 11 (10-249 any value), SL04 box then will play index=3 dmx file loop 5 times.
2: Next time, If you want play dmx file in playlist index=7, loop 0 times:
 In your dmx consoler, channel3 push to 0, channel2 push to 7, channel1 push to 10-249 value, like 20, the new value cannot be equal to the old value(11), SL04 box then will play index=7 dmx file once.
3: Next time, If you want play all dmx file in playlist, loop 200 times:
 In your dmx consoler, channel3 push to 200, channel2=start play file's index value, if this value above playlist file index, will play from the first dmx file, channel1 push to 255, SL04 box then will play all dmx file in playlist loop 200 times.
4: If you want stop the playing:
 In your dmx consoler, channel3 not care, channel2 not care, channel1 push to 0-9 value, like 0, SL04 box then will stop playing.
5: Please note: For any different operation, channel 1 must change the current value, and the new value cannot be equal to the old value, the time for any different operation cannot be less than 500ms, so the dmx value does not need to be set to the FADE value.

 ⚡Web SDK, If you can do web pages, then you can develop dmx app, it's so easy!

How to do ?
Way 1
:
1: Make your own html, js, css file, copy to TF card root directory.
2: In your html file include our sdk.js like this <script src="../sdk.js"></script>
3: In your js or html call our web sdk.js function senddmx(PORT, buf), send 512 byte dmxdata to box. PORT=0,1,2,3, buf=each port 512 byte dmxdata buf[512]
4: Browse http://2.0.0.44/tf/your.html

Way1 Example source code, web files save in box's TF card:
your.html source code:
<html>
 <head>
 <script src="../sdk.js"></script>
 <script src="./your.js"></script>
 </head>
<body>
This is a WebSDK for test! files save in remote box's TF card.
<button onclick="test()"> Send to Box </button>
</body>
</html>

your.js source code:
var dmxdata = [new Uint8Array(512), new Uint8Array(512),new Uint8Array(512),new Uint8Array(512)]; //4 PORT dmx buf;
function test(){
 for(var n=0; n<4; n++){ //box have 4 PORT
  for(var i=0; i<512; i++){ //each PORT have 512 channels
    dmxdata[n][i] = i; //(byte) all dmx channels value loop to 0-255
   }
   senddmx(n, dmxdata[n]); //call box SDK function send to box
 }
}


Way 2:
SL04 Box as a web server, can supports web cross-domain requests, so you can make beautiful touch webui or web APP on your own tablet or computer or mobile phone, all web files not save in box's TF card, it's save in your local device, In your js or html remote call our web sdk.js function http_senddmx(http_link, PORT, buf), send 512 byte RAW dmxdata to box, or can let your touch webui or APP call TF card offline dmx file through our http API, which can be very powerful.
Web files all save in local device, so you only open local html file then will succeed.
Tips: Copy the contents of the following two files to Notepad, save them as your.html and your.js file names respectively, and then open the your.html with a browser to see the effect.

Way2 Example source code, web files in local device, remote call box web API:
your.html source code:
<html>
 <head>
 <script src="http://2.0.0.44/sdk.js"></script>
 <script src="./your.js"></script>
 </head>
<body>
This is a WebSDK for test! files save in local device.<br>
<button onclick="test()"> Send to Box </button>
<button onclick="set_data(0)"> AllZero </button>
<button onclick="set_data(255)"> All255 </button>
</body>
</html>

your.js source code:
var dmxdata = new Uint8Array(512);
var ht=0;
var port_count=0;
function add(){
 for(var i=0; i<512; i++)
  dmxdata[i] +=2;
 var port = (port_count++)%4; //for change each PORT0,1,2,3
 http_senddmx("http://2.0.0.44", port , dmxdata);
}
function test(){
 if (ht) {
  clearInterval(ht);
  ht = 0;
 }else {
  ht = setInterval("add()",55);//55ms auto add
 }
}
function set_data(data){
 if (ht) {
  clearInterval(ht);
  ht = 0;
 }
 for(var i=0; i<512; i++)
  dmxdata[i] = data;
 for(var i=0; i<4; i++)
  http_senddmx("http://2.0.0.44", i , dmxdata);
}

Please note:
Because the SL04 box has a lot of things to deal with, it is recommended that when calling the box web API, the time interval should be greater than 50ms to send a package, not too often, and leave some free time for the box to process other things.
Tips: RJ45 LAN port uses the DMA function, and the processing speed is faster than that of USB virtual network card, Therefore, it is better to use the LAN network port as much as possible.

Copyright(c) by hahan