<root>
<document scada='1' projtype='3' panel2DSCADA='0' panel3DSCADA='0' panelPropsSCADA='0' panelConsoleSCADA='0' panelDataRecorderSCADA='0' panel2DCount='1' panel2DSCADA_0='6' playbackSCADA='0' ShouldAutoStartSCADA='0' ShouldLockCameraSCADA='0' ShouldBundleSCADA='1' SCADAProgramTitle='' buildnumber='0' schema='103' license='1,82702381,95CJQR' title='Blank PC' description='A new PC Developer project suitable for creating apps that run on the PC' fcversion='720896' target='SCADA.SCADA.GENERIC' >
	<config data='' clkspd='100000000' simspd='1' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='.Result' />
		<watch expr='.DeviceCount' />
		<watch expr='.DeviceName' />
		<watch expr='.DeviceAddress' />
		<watch expr='.i' />
		<watch expr='.DeviceIdLow' />
		<watch expr='.DeviceIdHigh' />
	</debug>
	<traces />
	<ghost >
		<FK2 >
			<data name='FK2D0' port='4294967295' pin='4294967295' />
			<data name='FK2D1' port='4294967295' pin='4294967295' />
			<data name='FK2D2' port='4294967295' pin='4294967295' />
			<data name='FK2D3' port='4294967295' pin='4294967295' />
			<data name='FK2D4' port='4294967295' pin='4294967295' />
			<data name='FK2D5' port='4294967295' pin='4294967295' />
			<data name='FK2D6' port='4294967295' pin='4294967295' />
			<data name='FK2D7' port='4294967295' pin='4294967295' />
			<data name='FK2D8' port='4294967295' pin='4294967295' />
			<data name='FK2D9' port='4294967295' pin='4294967295' />
			<data name='FK2D10' port='4294967295' pin='4294967295' />
			<data name='FK2D11' port='4294967295' pin='4294967295' />
			<data name='FK2D12' port='4294967295' pin='4294967295' />
			<data name='FK2D13' port='4294967295' pin='4294967295' />
			<data name='FK2D14' port='4294967295' pin='4294967295' />
			<data name='FK2D15' port='4294967295' pin='4294967295' />
			<data name='FK2A0' port='4294967295' pin='4294967295' />
			<data name='FK2A1' port='4294967295' pin='4294967295' />
			<data name='FK2A2' port='4294967295' pin='4294967295' />
			<data name='FK2A3' port='4294967295' pin='4294967295' />
			<data name='FK2A4' port='4294967295' pin='4294967295' />
			<data name='FK2A5' port='4294967295' pin='4294967295' />
		</FK2>
		<ICD >
			<data name='AnalogPrescaleValue' value='19' />
			<data name='DigitalSampleRate' value='100000' />
			<data name='BreakpointCount' value='8' />
			<data name='CallStackDepthCount' value='8' />
			<data name='ClockPort' value='4095' />
			<data name='ClockPin' value='0' />
			<data name='DataPort' value='4095' />
			<data name='DataPin' value='0' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='2' />
			<data name='CalculatedCommsDelay' value='2' />
			<data name='AnalogEB2PrescaleValue' value='2' />
			<data name='DigitalEB2SampleRate' value='100000' />
		</ICD>
		<pins >
			<digital A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
			<analog A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
		</pins>
	</ghost>
	<components >
		<settings autoimg='0' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='55fa09f1-703e-4400-b2b5-8391f161a368' vstate='40' vmin='0' vmaj='1' srcleaf='BLE GATT SPP.fcpcd' visiblename='BLE GATT SPP' description='A simple component to communicate with BLE GATT SPP enabled devices.' category='Comms: Interface ' category2='' category3='' bIs2dOnly='1' bIs3dOnly='0' bIsWysiwyg='0' catenable='1' author='Matrix TSL' manuname='' manucode='' sysinfo='4103' keywords='' dynamic='1' scadaCompatible='1' embeddedCompatible='1' showmacros='1' iconpath='..\..\..\Components\Icons\Components\Bluetooth.png' />
		<component class_type='root' codename='BLE_GATT_SPP' panelId='-1' x='0' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' ancTop='0' ancBottom='0' ancLeft='0' ancRight='0' ancMinX='0' ancMinY='0' comp2dType='0' >
			<resources />
			<properties />
			<values />
			<events >
				<event class='Simulation' event='Stop' target='Ev_Stop' />
			</events>
			<apis >
				<api name='Connect' alt='Connect' type='2' proto='1' />
				<api name='SetServiceUUID' alt='SetServiceUUID' type='2' proto='1' />
				<api name='GetDeviceAddress' alt='GetDeviceAddress' type='2' proto='1' />
				<api name='IsDataAvailable' alt='IsDataAvailable' type='2' proto='1' />
				<api name='ResetUUIDs' alt='ResetUUIDs' type='2' proto='1' />
				<api name='Read' alt='Read' type='2' proto='1' />
				<api name='Cleanup' alt='Cleanup' type='2' proto='1' />
				<api name='Disconnect' alt='Disconnect' type='2' proto='1' />
				<api name='ClearDevices' alt='ClearDevices' type='2' proto='1' />
				<api name='GetLastError' alt='GetLastError' type='2' proto='1' />
				<api name='IsConnected' alt='IsConnected' type='2' proto='1' />
				<api name='StartScan' alt='StartScan' type='2' proto='1' />
				<api name='GetDeviceName' alt='GetDeviceName' type='2' proto='1' />
				<api name='GetDeviceCount' alt='GetDeviceCount' type='2' proto='1' />
				<api name='SetWriteCharacteristicUUID' alt='SetWriteCharacteristicUUID' type='2' proto='1' />
				<api name='Write' alt='Write' type='2' proto='1' />
				<api name='ConnectById' alt='ConnectById' type='2' proto='1' />
				<api name='StopScan' alt='StopScan' type='2' proto='1' />
				<api name='GetDeviceId' alt='GetDeviceId' type='2' proto='1' />
				<api name='Initialise' alt='Initialise' type='2' proto='1' />
				<api name='SetReadCharacteristicUUID' alt='SetReadCharacteristicUUID' type='2' proto='1' />
			</apis>
			<variables >
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Connected' type='b1' description='' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='BLESPP_Disconnect' description='Disconnect from the current BLE device. Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_Read' description='Read data from the connected BLE device. Returns: Number of bytes read or error code' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='Buffer' type='u8' description='Pointer to buffer to store read data' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<param name='BufferSize' type='s16' description='Maximum number of bytes to read' isconst='0' isHidden='0' isinit='0' usrinit='256' setinit='256' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_GetDiscoveredDeviceName' description='Get device name by index. Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIndex' type='s16' description='Index of the device (0-based)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceName' type='T8*' description='Buffer to store device name' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<param name='BufferSize' type='s16' description='Size of the buffer' isconst='0' isHidden='0' isinit='0' usrinit='256' setinit='256' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Ev_Stop' description='Broadcast to all components that simulation has stopped' statediag='0' >
						<return name='Return' type='u32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='decision' title='Decision' exp='Connected' swap='0' >
							<flowline >
								<command class_type='call' title='User Macro' macro='Disconnect' />
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_StopScan' description='Stop scanning for BLE devices. Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_SetServiceUUID' description='Set Service UUID (16-bit or 128-bit). Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID16' type='u16' description='16-bit UUID value (e.g., 0xFFE0). Set to 0 to use full 128-bit UUID' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID128' type='T8*' description='Full 128-bit UUID string (used if uuid16 is 0)' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='37' />
						</param>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_Write' description='Write data to the connected BLE device. Returns: Number of bytes written or error code' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='Data' type='u8' description='Pointer to data buffer' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<param name='DataLength' type='s16' description='Number of bytes to write' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Connect' description='Connect to a BLE device by address. Returns: 0 on success, error code on failure' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceAddress' type='T8' description='Bluetooth address in format &quot;XX:XX:XX:XX:XX:XX&quot;' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='18' />
						</param>
						<command class_type='call' title='User Macro' macro='BLESPP_Connect' >
							<return exp='.Return' />
							<argument exp='.DeviceAddress' />
						</command>
						<command class_type='decision' title='Decision' exp='.Return = 0' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='Connected = 1' />
								</command>
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SetServiceUUID' description='Set Service UUID (16-bit or 128-bit). Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID16' type='u16' description='16-bit UUID value (e.g., 0xFFE0). Set to 0 to use full 128-bit UUID' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID128' type='T8' description='Full 128-bit UUID string (used if uuid16 is 0)' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='37' />
						</param>
						<command class_type='call' title='User Macro' macro='BLESPP_SetServiceUUID' >
							<return exp='.Return' />
							<argument exp='.UUID16' />
							<argument exp='.UUID128' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_IsDataAvailable' description='Check if data is available to read. Returns: 1 if data available, 0 if no data' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_ConnectById' description='Connect to a BLE device by device ID. Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdLow' type='u32' description='Device ID low 32 bits' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdHigh' type='u32' description='Device ID high 32 bits (typically 0)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='GetDeviceAddress' description='Get device address by index. Returns: 0 on success, error code on failure' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIndex' type='s16' description='Index of the device (0-based)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceAddress' type='T8*' description='Buffer to store device address' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='18' />
						</param>
						<command class_type='call' title='User Macro' macro='BLESPP_GetDiscoveredDeviceAddress' >
							<return exp='.Return' />
							<argument exp='.DeviceIndex' />
							<argument exp='.DeviceAddress' />
							<argument exp='18' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='IsDataAvailable' description='Check if data is available to read. Returns: 1 if data available, 0 if no data' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_IsDataAvailable' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ResetUUIDs' description='Reset UUIDs to default values. Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_ResetUUIDsToDefault' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Read' description='Read data from the connected BLE device. Returns: Number of bytes read or error code' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='Buffer' type='u8' description='Buffer to store read data' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<param name='BufferSize' type='s16' description='Maximum number of bytes to read' isconst='0' isHidden='0' isinit='0' usrinit='256' setinit='256' />
						<command class_type='call' title='User Macro' macro='BLESPP_Read' >
							<return exp='.Return' />
							<argument exp='.Buffer' />
							<argument exp='.BufferSize' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Cleanup' description='Cleanup and shutdown the BLE SPP DLL. Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_Cleanup' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_GetLastError' description='Get the last error message. Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='ErrorMessage' type='T8*' description='Buffer to store error message' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<param name='BufferSize' type='s16' description='Size of the buffer' isconst='0' isHidden='0' isinit='0' usrinit='256' setinit='256' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Disconnect' description='Disconnect from the current BLE device. Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_Disconnect' >
							<return exp='.Return' />
						</command>
						<command class_type='calculation' title='Calculation' >
							<exp exp='Connected = 0' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ClearDevices' description='Clear the list of discovered devices. Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_ClearDiscoveredDevices' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_StartScan' description='Start scanning for BLE devices. Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_IsConnected' description='Check if currently connected to a device. Returns: 1 if connected, 0 if not connected' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='GetLastError' description='Get the last error message. Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='ErrorMessage' type='T8*' description='Buffer to store error message' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<command class_type='call' title='User Macro' macro='BLESPP_GetLastError' >
							<return exp='.Return' />
							<argument exp='.ErrorMessage' />
							<argument exp='256' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_GetDiscoveredDeviceId' description='Get device ID by index. Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIndex' type='s16' description='Index of the device (0-based)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdLow' type='u32' description='Pointer to store device ID low 32 bits' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdHigh' type='u32' description='Pointer to store device ID high 32 bits (optional)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='StartScan' description='Start scanning for BLE devices. Returns: 0 on success, error code on failure' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_StartScan' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='IsConnected' description='Check if currently connected to a device. Returns: 1 if connected, 0 if not connected' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_IsConnected' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_Initialize' description='Initialize the BLE SPP DLL. Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_ClearDiscoveredDevices' description='Clear the list of discovered devices. Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_SetWriteCharacteristicUUID' description='Set Write Characteristic UUID (16-bit or 128-bit). Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID16' type='u16' description='16-bit UUID value (e.g., 0xFFE1). Set to 0 to use full 128-bit UUID' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID128' type='T8*' description='Full 128-bit UUID string (used if uuid16 is 0)' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='37' />
						</param>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetDeviceName' description='Get device name by index. Returns: 0 on success, error code on failure' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIndex' type='s16' description='Index of the device (0-based)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceName' type='T8*' description='Buffer to store device name' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<command class_type='call' title='User Macro' macro='BLESPP_GetDiscoveredDeviceName' >
							<return exp='.Return' />
							<argument exp='.DeviceIndex' />
							<argument exp='.DeviceName' />
							<argument exp='256' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetDeviceCount' description='Get the number of discovered devices. Returns: Number of devices or error code' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_GetDiscoveredDeviceCount' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Write' description='Write data to the connected BLE device. Returns: Number of bytes written or error code' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='Data' type='u8' description='Data buffer array' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='256' />
						</param>
						<param name='DataLength' type='s16' description='Number of bytes to write' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_Write' >
							<return exp='.Return' />
							<argument exp='.Data' />
							<argument exp='.DataLength' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SetWriteCharacteristicUUID' description='Set Write Characteristic UUID (16-bit or 128-bit). Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID16' type='u16' description='16-bit UUID value (e.g., 0xFFE1). Set to 0 to use full 128-bit UUID' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID128' type='T8' description='Full 128-bit UUID string (used if uuid16 is 0)' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='37' />
						</param>
						<command class_type='call' title='User Macro' macro='BLESPP_SetWriteCharacteristicUUID' >
							<return exp='.Return' />
							<argument exp='.UUID16' />
							<argument exp='.UUID128' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_SetReadCharacteristicUUID' description='Set Read Characteristic UUID (16-bit or 128-bit). Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID16' type='u16' description='16-bit UUID value (e.g., 0xFFE1). Set to 0 to use full 128-bit UUID' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID128' type='T8*' description='Full 128-bit UUID string (used if uuid16 is 0)' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='37' />
						</param>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_Connect' description='Connect to a BLE device by address. Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceAddress' type='T8*' description='Bluetooth address in format &quot;XX:XX:XX:XX:XX:XX&quot;' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='18' />
						</param>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_GetDiscoveredDeviceCount' description='Get the number of discovered devices. Returns: Number of devices or error code' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='StopScan' description='Stop scanning for BLE devices. Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_StopScan' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ConnectById' description='Connect to a BLE device by device ID. Returns: 0 on success, error code on failure' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdLow' type='u32' description='Device ID low 32 bits (obtained from GetDeviceId)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdHigh' type='u32' description='Device ID high 32 bits (typically 0)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_ConnectById' >
							<return exp='.Return' />
							<argument exp='.DeviceIdLow' />
							<argument exp='.DeviceIdHigh' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_GetDiscoveredDeviceAddress' description='Get device address by index. Returns: 0 on success, error code on failure' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIndex' type='s16' description='Index of the device (0-based)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceAddress' type='T8*' description='Buffer to store device address' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='18' />
						</param>
						<param name='BufferSize' type='s16' description='Size of the buffer' isconst='0' isHidden='0' isinit='0' usrinit='18' setinit='18' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_Cleanup' description='Cleanup and shutdown the BLE SPP DLL. Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='Example usage demonstrating BLE SPP DLL functionality' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<local name='Result' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='DeviceCount' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='i' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='DeviceName' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='256' />
						</local>
						<local name='DeviceAddress' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='18' />
						</local>
						<local name='DeviceIdLow' type='u32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='DeviceIdHigh' type='u32' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='TestData' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;\&quot;\&quot;&quot;' setinit='&quot;&quot;' >
							<array size='256' />
						</local>
						<local name='ReadBuffer' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;\&quot;\&quot;&quot;' setinit='&quot;&quot;' >
							<array size='256' />
						</local>
						<local name='BytesWritten' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='BytesRead' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='DataAvailable' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='0' />
						<local name='ErrorMessage' type='T8' description='' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='&quot;&quot;' >
							<array size='256' />
						</local>
						<local name='data' type='u8' description='' isconst='0' isHidden='0' isinit='1' usrinit='&quot; 0 &quot;' setinit='{0}' >
							<array size='10' />
						</local>
						<command class_type='call' title='User Macro' macro='BLESPP_Initialize' >
							<return exp='.Result' />
						</command>
						<command class_type='call' title='User Macro' macro='StartScan' >
							<return exp='.Result' />
						</command>
						<command class_type='delay' title='Delay' exp='2' type='2' />
						<command class_type='call' title='User Macro' macro='StopScan' />
						<command class_type='call' title='User Macro' macro='GetDeviceCount' >
							<return exp='.DeviceCount' />
						</command>
						<command class_type='decision' title='Decision' exp='.DeviceCount &gt; 0' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' >
									<exp exp='.i = 0' />
								</command>
								<command class_type='loop' title='Loop' type='0' exp='.i &lt; .DeviceCount' >
									<flowline >
										<command class_type='call' title='User Macro' macro='GetDeviceName' >
											<return exp='.Result' />
											<argument exp='.i' />
											<argument exp='.DeviceName' />
										</command>
										<command class_type='call' title='User Macro' macro='GetDeviceAddress' >
											<return exp='.Result' />
											<argument exp='.i' />
											<argument exp='.DeviceAddress' />
										</command>
										<command class_type='call' title='User Macro' macro='GetDeviceId' >
											<return exp='.Result' />
											<argument exp='.i' />
											<argument exp='.DeviceIdLow' />
											<argument exp='.DeviceIdHigh' />
										</command>
										<command class_type='calculation' title='Calculation' >
											<exp exp='.i = .i + 1' />
										</command>
										<command class_type='decision' title='Decision' exp='.DeviceName = &quot;Flowcode BT SPP&quot;' swap='0' >
											<flowline >
												<command class_type='call' title='User Macro' macro='Connect' >
													<return exp='.Result' />
													<argument exp='.DeviceAddress' />
												</command>
												<command class_type='decision' title='Decision' exp='.Result = 0' swap='0' >
													<flowline >
														<command class_type='loop' title='Loop' type='3' exp='1' >
															<flowline >
																<command class_type='delay' title='Delay' exp='1' type='2' />
																<command class_type='calculation' title='Calculation' >
																	<exp exp='.data[0] = .i' />
																</command>
																<command class_type='call' title='User Macro' macro='Write' >
																	<argument exp='.data' />
																	<argument exp='1' />
																</command>
																<command class_type='calculation' title='Calculation' >
																	<exp exp='.i = .i + 1' />
																</command>
															</flowline>
														</command>
													</flowline>
													<flowline />
												</command>
											</flowline>
											<flowline />
										</command>
									</flowline>
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='decision' title='Decision' exp='.DeviceCount &gt; 0' swap='0' >
							<flowline >
								<command class_type='call' title='User Macro' macro='GetDeviceId' >
									<return exp='.Result' />
									<argument exp='0' />
									<argument exp='.DeviceIdLow' />
									<argument exp='.DeviceIdHigh' />
								</command>
								<command class_type='call' title='User Macro' macro='ConnectById' >
									<return exp='.Result' />
									<argument exp='.DeviceIdLow' />
									<argument exp='.DeviceIdHigh' />
								</command>
								<command class_type='call' title='User Macro' macro='IsConnected' >
									<return exp='.Result' />
								</command>
								<command class_type='decision' title='Decision' exp='.Result = 1' swap='0' >
									<flowline >
										<command class_type='calculation' title='Calculation' >
											<exp exp='.TestData[0] = 0x48' />
											<exp exp='.TestData[1] = 0x65' />
											<exp exp='.TestData[2] = 0x6C' />
											<exp exp='.TestData[3] = 0x6C' />
											<exp exp='.TestData[4] = 0x6F' />
										</command>
										<command class_type='call' title='User Macro' macro='Write' >
											<return exp='.BytesWritten' />
											<argument exp='.TestData' />
											<argument exp='5' />
										</command>
										<command class_type='call' title='User Macro' macro='IsDataAvailable' >
											<return exp='.DataAvailable' />
										</command>
										<command class_type='decision' title='Decision' exp='.DataAvailable &gt; 0' swap='0' >
											<flowline >
												<command class_type='call' title='User Macro' macro='Read' >
													<return exp='.BytesRead' />
													<argument exp='.ReadBuffer' />
													<argument exp='256' />
												</command>
											</flowline>
											<flowline />
										</command>
										<command class_type='call' title='User Macro' macro='Disconnect' />
									</flowline>
									<flowline />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='call' title='User Macro' macro='ClearDevices' />
						<command class_type='call' title='User Macro' macro='Cleanup' />
					</flowline>
				</macro>
				<macro >
					<flowline name='BLESPP_ResetUUIDsToDefault' description='Reset UUIDs to default values. Returns: 0 on success' statediag='0' dllpath='$(appdir)API.DLL\BLE_SPP_DLL.dll' dllcall='115' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Initialise' description='Initialise the BLE SPP DLL. Returns: 0 on success, error code on failure' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_Initialize' >
							<return exp='.Return' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='GetDeviceId' description='Get device ID by index. Returns: 0 on success, error code on failure' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIndex' type='s16' description='Index of the device (0-based)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdLow' type='u32' description='Device ID low 32 bits' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='DeviceIdHigh' type='u32' description='Device ID high 32 bits (optional, typically 0)' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='call' title='User Macro' macro='BLESPP_GetDiscoveredDeviceId' >
							<return exp='.Return' />
							<argument exp='.DeviceIndex' />
							<argument exp='.DeviceIdLow' />
							<argument exp='.DeviceIdHigh' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='SetReadCharacteristicUUID' description='Set Read Characteristic UUID (16-bit or 128-bit). Returns: 0 on success' statediag='0' >
						<return name='Return' type='s16' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID16' type='u16' description='16-bit UUID value (e.g., 0xFFE1). Set to 0 to use full 128-bit UUID' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='UUID128' type='T8' description='Full 128-bit UUID string (used if uuid16 is 0)' isconst='0' isHidden='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
							<array size='37' />
						</param>
						<command class_type='call' title='User Macro' macro='BLESPP_SetReadCharacteristicUUID' >
							<return exp='.Return' />
							<argument exp='.UUID16' />
							<argument exp='.UUID128' />
						</command>
					</flowline>
				</macro>
			</macros>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='7292207' img='' style='0' />
		<camera xe='0' ye='0' ze='324.28' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='268' dy='849' zoom='100' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='16777215' />
		<winpos ID='7005' RectRecentFloat='-1236,281,-586,731' RectRecentDocked='0,0,268,872' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='0' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey0 xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey1 xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<camerakey2 xe='0' ye='-300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.707107' yquat='0' zquat='0' wquat='0.707107' />
		<camerakey3 xe='-3.67394e-14' ye='300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-4.32978e-17' yquat='0.707107' zquat='0.707107' wquat='4.32978e-17' />
		<camerakey4 xe='-300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='0.5' zquat='0.5' wquat='0.5' />
		<camerakey5 xe='300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='-0.5' zquat='-0.5' wquat='0.5' />
		<camerakey6 xe='-173.205' ye='-173.205' ze='173.205' xt='0' yt='0' zt='0' xquat='-0.424708' yquat='0.17592' zquat='0.339851' wquat='0.820473' />
		<winpos ID='7004' RectRecentFloat='0,425,654,1002' RectRecentDocked='0,0,543,864' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='0' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
	</panel3d>
	<panels2d count='1' >
		<panel2d_0 id='0' name='2D Panel' type='0' >
			<winpos ID='1171' RectRecentFloat='1035,428,1685,878' RectRecentDocked='942,141,1489,714' RecentFrameAlignment='16384' RecentRowIndex='0' IsFloating='1' MRUWidth='32767' PinState='0' IsMaximized='0' IsVisible='0' />
			<background fill='288230376151053813' showgrid='1' gridstyle='1' gridsize='10' gridbrush='71776119075691740' snaptogrid='1' fitcomp='0' disp_x='300' disp_y='400' scale='100' disp_col='16777215' />
		</panel2d_0>
	</panels2d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='75' scrollx='0' scrolly='792' flags='0' />
		<view type='0' name='BLESPP_Initialize' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Initialise' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='StartScan' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='BLESPP_StartScan' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='GetDeviceName' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='BLESPP_GetDiscoveredDeviceName' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='GetDeviceAddress' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Write' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Read' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Ev_Stop' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Connect' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Disconnect' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAQQQAADgCAAA' zoom='100' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
