StartX() - The StartX Command

The StartX() command actively listens to incoming binary or hex messages on an IP port and will start the task when a matching message is received. You can also manually start the task and it will just run past this command.
A dedicated TCP IPv4 port configured as "Text and Binary Integration" is required for it to work.

Configuration

Configure a TCP IPv4 Port as "Text and Binary Integration"
image::TextBinaryPort.png[Screenshot of port configured as Text and Binary Integration]

Syntax

StartX(x,x,…​n)
An "x" is a wild card and can trigger off of any value. You can specify any portion of the packet and use wildcards for the rest.
The packet can be of any length and be made up of decimal or hex byte values.

Examples

Example 1

Task2()
{
Name="Trigger from IP packet"
StartX(0x01,x,0x03,x,x,x,0x07) //Task will start off an IP packet received on the "Text and Binary Integration" Port.
}

Example 2

This example triggers off packets sent from a Vingcard server.

Task14()
{
Name="VingCard Integration"
	//Listen to the room events//
	//VisiOnline packets have a 10 Byte header and a 3 byte footer
	//Third byte in the actual message is the event number and 8th and 9th byte gives the room number//
	//9th byte is the first byte for room number and if it is above 255, then 8th byte will be used//

	//*****Event Number & Description***
	//	0	: Guest Entrance
	//	1	: Staff Entrance
	//	2	: Inside Open
	//	3	: Deadbolt Thrown
	//	4	: Deadbolt Released
	//	5	: Door Closed
	//
	Startx(x,x,x,x,x,x,x,x,x,x,0x00,0x00,x,0x00,0x00,0x00,0x00,x,x,x,x,x)
	Copy @0,~0,19
	//Get the room number
	LDA ~17
	STA ~RoomNumHighByte
	LDA ~18
	STA ~RoomNumLowByte

	LDA ~12 //Get the Event Number
	CMP #0x00 //Guest Entrance
	BRZ Guest
	CMP #0x01
	BRZ Staff
	CMP #0x02
	BRZ InsideOpen
	CMP #0x03
	BRZ DeadboltThrown
	CMP #0x04
	BRZ DeadboltRelease
	CMP #0x05
	BRZ DoorClosed
	Null

	Guest:
		Copy LinearPresetMessage,~30, 7
		LDA #VingCardAreaNumber
		STA ~31
		LDA #GuestEntrancePreset
		STA ~32
		LDA ~RoomNumHighByte
		STA ~34
		LDA ~RoomNumLowByte
		STA ~35
		TX ~30,8,7
		Null
        ...
}