index.js
function UserPacket(commands){
		Packet.call(this);
		this.interval = undefined;

		// If the packet contains commands
		if (typeof commands !== 'undefined'){
			// If it is a connect packet
			if (commands === null) {
				this.header.flags = flags.connect;
				this.body.commands = [{
					get length() { return 8; },
					serialize: function() {
						const connectCmd = '0100000000000000';
						return (new Buffer(connectCmd, 'hex'));
					}
				}];
			}
			else {
				this.body.commands = commands;
				this.header.flags = flags.sync;
			}
		}

		// If the packet contains no commands
		else {
			this.header.flags = flags.sync;
		}
	}
function UserPacket(commands){
		Packet.call(this);
		this.interval = undefined;

		// If the packet contains commands
		if (typeof commands !== 'undefined'){
			// If it is a connect packet
			if (commands === null) {
				this.header.flags = flags.connect;
				this.body.commands = [{
					get length() { return 8; },
					serialize: function() {
						const connectCmd = '0100000000000000';
						return (new Buffer(connectCmd, 'hex'));
					}
				}];
			}
			else {
				this.body.commands = commands;
				this.header.flags = flags.sync;
			}
		}

		// If the packet contains no commands
		else {
			this.header.flags = flags.sync;
		}
	}
function UserPacket ( commands ) { Packet . call ( this ) ; this . interval = undefined ; // If the packet contains commands if ( typeof commands !== 'undefined' ) { // If it is a connect packet if ( commands === null ) { this . header . flags = flags . connect ; this . body . commands = [ { get length ( ) { return 8 ; } , serialize : function ( ) { const connectCmd = '0100000000000000' ; return ( new Buffer ( connectCmd , 'hex' ) ) ; } } ] ; } else { this . body . commands = commands ; this . header . flags = flags . sync ; } } // If the packet contains no commands else { this . header . flags = flags . sync ; } }
Create a custom UserPacket.

@constructor UserPacket
@augments Packet
@classdesc A Packet commissiond by the user. This is used to send messages to the ATEM.

@param {Command[]|null} [commands] An array of commands. If null, a connect packet will be created
Create a custom UserPacket .