/****************************************************************************
 *
 * Filename:    ps2000aWrap.h
 * Copyright:   Pico Technology Limited 2011 - 2014
 * Author:      HSM
 * Description:
 *
 * This header defines the interface to the wrapper dll for the 
 *	PicoScope2000 series of PC Oscilloscopes using the PicoScope 2000 Series
 * A API.
 *
 ****************************************************************************/
#ifndef __PS2000AWRAP_H__
#define __PS2000AWRAP_H__

#include "ps2000aApi.h"

// 2200A series models have 2 analogue channels, 2205 MSO also has 2 digital ports
#define MAX_ANALOGUE_CHANNELS		(PS2000A_MAX_CHANNELS / 2)			// 2
#define MAX_DIGITAL_PORTS			(PS2000A_MAX_DIGITAL_PORTS / 2)		// 2

#define MAX_ANALOGUE_BUFFERS		(PS2000A_MAX_CHANNEL_BUFFERS / 2)	// 4
#define MAX_DIGITAL_BUFFERS			4									// 4 - Port 0 Max/Min and Port 1 Max/Min

// Enum to define Digital Port indices
typedef enum enPS2000AWrapDigitalPortIndex
{
	PS2000A_WRAP_DIGITAL_PORT0,
	PS2000A_WRAP_DIGITAL_PORT1
} PS2000A_WRAP_DIGITAL_PORT_INDEX;

extern PICO_STATUS __declspec(dllexport) __stdcall RunBlock
(
	int16_t handle, 
	int32_t preTriggerSamples, 
	int32_t postTriggerSamples, 
	uint32_t timebase,
	uint16_t segmentIndex
);

extern PICO_STATUS __declspec(dllexport) __stdcall GetStreamingLatestValues
(
	int16_t handle
);

extern int32_t __declspec(dllexport) __stdcall AvailableData
(
	int16_t handle, 
	uint32_t *startIndex
);

extern int16_t __declspec(dllexport) __stdcall AutoStopped
(
	int16_t handle
);

extern int16_t __declspec(dllexport) __stdcall IsReady
(
	int16_t handle
);

extern int16_t __declspec(dllexport) __stdcall IsTriggerReady
(
	int16_t handle, 
	uint32_t *triggeredAt
);

extern PICO_STATUS __declspec(dllexport) __stdcall ClearTriggerReady
(
	int16_t handle
);

extern PICO_STATUS __declspec(dllexport) __stdcall SetTriggerConditions
(
	int16_t handle, 
	uint32_t * conditionsArray, 
	int16_t nConditions
);

extern PICO_STATUS __declspec(dllexport) __stdcall SetTriggerProperties
(
	int16_t handle, 
	uint32_t * propertiesArray, 
	int16_t nProperties,  
	int32_t autoTrig
);

extern PICO_STATUS __declspec(dllexport) __stdcall SetPulseWidthQualifier
(
	int16_t handle,
	uint32_t * pwqConditionsArray,
	int16_t nConditions,
	uint32_t direction,
	uint32_t lower,
	uint32_t upper,
	uint32_t type
);

extern PICO_STATUS __declspec(dllexport) __stdcall setChannelCount
(
	int16_t handle, 
	int16_t channelCount
);

extern PICO_STATUS __declspec(dllexport) __stdcall setEnabledChannels
(
	int16_t handle, 
	int16_t * enabledChannels
);

extern PICO_STATUS __declspec(dllexport) __stdcall setDigitalPortCount
(
	int16_t handle, 
	int16_t digitalPortCount
);

extern PICO_STATUS __declspec(dllexport) __stdcall setEnabledDigitalPorts
(
	int16_t handle, 
	int16_t * enabledDigitalPorts
);

extern PICO_STATUS __declspec(dllexport) __stdcall setAppAndDriverBuffers
(
	int16_t handle, 
	int16_t channel, 
	int16_t * appBuffer, 
	int16_t * driverBuffer,
	int32_t bufferLength
);

extern PICO_STATUS __declspec(dllexport) __stdcall setMaxMinAppAndDriverBuffers
(
	int16_t handle, 
	int16_t channel, 
	int16_t * appMaxBuffer,
	int16_t * appMinBuffer, 
	int16_t * driverMaxBuffer, 
	int16_t * driverMinBuffer,
	int32_t bufferLength
);

extern PICO_STATUS __declspec(dllexport) __stdcall setAppAndDriverDigiBuffers
(
	int16_t handle, 
	int16_t digiPort, 
	int16_t * appDigiBuffer, 
	int16_t * driverDigiBuffer,
	int32_t bufferLength
);

extern PICO_STATUS __declspec(dllexport) __stdcall setMaxMinAppAndDriverDigiBuffers
(
	int16_t handle, 
	int16_t digiPort, 
	int16_t * appMaxDigiBuffer,
	int16_t * appMinDigiBuffer, 
	int16_t * driverMaxDigiBuffer, 
	int16_t * driverMinDigiBuffer,
	int32_t bufferLength
);
#endif