<commit_before>PROGRAM_NAME='huddleDXLinkListener'


#define INCLUDE_DXLINK_NOTIFY_TX_VIDEO_INPUT_STATUS_ANALOG_CALLBACK;
#define INCLUDE_DXLINK_NOTIFY_TX_VIDEO_INPUT_STATUS_DIGITAL_CALLBACK;


define_variable

volatile dev dvDxlinkTxDigitalVideoInPorts[1];
volatile dev dvDxlinkTxAnalogVidInPorts[1];


#include 'amx-dxlink-api';
#include 'amx-dxlink-listener';


define_function dxlinkNotifyTxVideoInputStatusAnalog (dev dxlinkTxAnalogVideoInput, char signalStatus[])
{
	if (dxlinkTxAnalogVideoInput == dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_ANALOG:dvTx.SYSTEM)
	{
		handleSignalStatusEvent(SOURCE_VGA, signalStatus == DXLINK_SIGNAL_STATUS_VALID_SIGNAL);
	}
}

define_function dxlinkNotifyTxVideoInputStatusDigital (dev dxlinkTxDigitalVideoInput, char signalStatus[])
{
	if (dxlinkTxDigitalVideoInput == dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_DIGITAL:dvTx.SYSTEM)
	{
		handleSignalStatusEvent(SOURCE_HDMI, signalStatus == DXLINK_SIGNAL_STATUS_VALID_SIGNAL);
	}
}


define_event

data_event[dvTx]
{

	online:
	{
		dxlinkDisableTxVideoInputAutoSelect(data.device);
	}

}


define_start

dvDxlinkTxDigitalVideoInPorts[1] = dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_DIGITAL:dvTx.SYSTEM;
set_length_array(dvDxlinkTxDigitalVideoInPorts, 1);

dvDxlinkTxAnalogVidInPorts[1] = dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_ANALOG:dvTx.SYSTEM;
set_length_array(dvDxlinkTxAnalogVidInPorts, 1);

rebuild_event();<commit_msg>Buffered incoming signal change events<commit_after>PROGRAM_NAME='huddleDXLinkListener'


#define INCLUDE_DXLINK_NOTIFY_TX_VIDEO_INPUT_STATUS_ANALOG_CALLBACK;
#define INCLUDE_DXLINK_NOTIFY_TX_VIDEO_INPUT_STATUS_DIGITAL_CALLBACK;


define_variable

volatile dev dvDxlinkTxDigitalVideoInPorts[1];
volatile dev dvDxlinkTxAnalogVidInPorts[1];


#include 'amx-dxlink-api';
#include 'amx-dxlink-listener';


define_function dxlinkNotifyTxVideoInputStatusAnalog (dev dxlinkTxAnalogVideoInput, char signalStatus[])
{
	if (dxlinkTxAnalogVideoInput == dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_ANALOG:dvTx.SYSTEM)
	{
		local_var char hasSignal;

		hasSignal = signalStatus == DXLINK_SIGNAL_STATUS_VALID_SIGNAL;

		// When some devices are plugged in / unplugged it can cause a couple of
		// signal status events in quick succession. This will buffer this and
		// ensure we're not attempting to handle these while the device
		// stabalises.
		wait 5 'Analog signal status buffer'
		{
			handleSignalStatusEvent(SOURCE_VGA, hasSignal);
		}
	}
}

define_function dxlinkNotifyTxVideoInputStatusDigital (dev dxlinkTxDigitalVideoInput, char signalStatus[])
{
	if (dxlinkTxDigitalVideoInput == dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_DIGITAL:dvTx.SYSTEM)
	{
		local_var char hasSignal;

		hasSignal = signalStatus == DXLINK_SIGNAL_STATUS_VALID_SIGNAL;

		// As above, this will help ensure we're not attempting to deal with
		// signal state changes as attached devices freak out during connect /
		// disconnect.
		wait 5 'Digital signal status buffer'
		{
			handleSignalStatusEvent(SOURCE_HDMI, hasSignal);
		}
	}
}


define_event

data_event[dvTx]
{

	online:
	{
		dxlinkDisableTxVideoInputAutoSelect(data.device);
	}

}


define_start

dvDxlinkTxDigitalVideoInPorts[1] = dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_DIGITAL:dvTx.SYSTEM;
set_length_array(dvDxlinkTxDigitalVideoInPorts, 1);

dvDxlinkTxAnalogVidInPorts[1] = dvTx.NUMBER:DXLINK_PORT_VIDEO_INPUT_ANALOG:dvTx.SYSTEM;
set_length_array(dvDxlinkTxAnalogVidInPorts, 1);

rebuild_event();
{'fraction_non_alphanumeric': 0.07629107981220658, 'fraction_numerical': 0.004107981220657277, 'mean_word_length': 7.586901763224182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4544580', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1195, 'n_words': 191}