Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var b = new Set(Buffer.from("1B", "hex"))
- const arr = []
- for (let i = 0; i < msg.payload.length; i++) {
- if (b.has(msg.payload[i])) {
- arr.push(msg.payload[i + 1] - 0x80)
- i++
- }
- else arr.push(msg.payload[i])
- }
- for (let i = 0; i < arr.length / 16; i++) {
- let out = []
- out=(arr.slice(i * 16, (i + 1) * 16))
- if (out[9] == 7 && out[7] == 4){
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z1_vol',vol)
- }
- else if (out[9] == 6 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z2_vol', vol)
- }
- else if (out[9] == 5 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z3_vol', vol)
- }
- else if (out[9] == 4 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z4_vol', vol)
- }
- else if (out[9] == 8 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z5_vol', vol)
- }
- else if (out[9] == 10 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z6_vol', vol)
- }
- else if (out[9] == 15 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z7_vol', vol)
- }
- else if (out[9] == 17 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z8_vol', vol)
- }
- else if (out[9] == 18 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z9_vol', vol)
- }
- else if (out[9] == 12 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z10_vol', vol)
- }
- else if (out[9] == 13 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z11_vol', vol)
- }
- else if (out[9] == 14 && out[7] == 4) {
- var vol = Buffer.alloc(3)
- vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
- global.set('z12_vol', vol)
- }
- else if (out[9] == 39 && out[7] == 4) { global.set('z1m', out[13]) }
- else if (out[9] == 38 && out[7] == 4) { global.set('z2m', out[13]) }
- else if (out[9] == 37 && out[7] == 4) { global.set('z3m', out[13]) }
- else if (out[9] == 36 && out[7] == 4) { global.set('z4m', out[13]) }
- else if (out[9] == 40 && out[7] == 4) { global.set('z5m', out[13]) }
- else if (out[9] == 42 && out[7] == 4) { global.set('z6m', out[13]) }
- else if (out[9] == 48 && out[7] == 4) { global.set('z7m', out[13]) }
- else if (out[9] == 49 && out[7] == 4) { global.set('z8m', out[13]) }
- else if (out[9] == 50 && out[7] == 4) { global.set('z9m', out[13]) }
- else if (out[9] == 44 && out[7] == 4) { global.set('z10m', out[13]) }
- else if (out[9] == 45 && out[7] == 4) { global.set('z11m', out[13]) }
- else if (out[9] == 46 && out[7] == 4) { global.set('z12m', out[13]) }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement