unit coscom1_2; //all functions except coscomopenPort, coscomclosePort, isvalidCoscomDevice //call inside the function "isvalidCoscomDevice" so it isn't necessary to call //this function extra //the return value -1 means the function is unsupported by this device interface uses Windows; //type //CODE_Description_Begin(coscomopenPort) // opens port with portnumber 1 .. x // return value -4 means invalid portnumber // return value 0 means an error occurred // return value 1 means successful call of function //CODE_Description_End function coscomopenPort(portnumber : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomclosePort) // closes port with portnumber 1 .. x // return value -4 means invalid portnumber // return value 0 means an error occurred // return value 1 means successful call of function //CODE_Description_End function coscomclosePort(portnumber : Integer) : Integer; stdcall; //CODE_Description_Begin(isvalidCoscomDevice) // checks if the device is ready for function call with portnumber 1 .. x // return value -4 means invalid portnumber // return value 0 means the port isn't open // return value -2 means the port is opened but the device cann't be controlled // return value 1 means the device can controlled by user //CODE_Description_End function isvalidCoscomDevice(portnumber : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomgetVersion) // get the device eprom software version with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // versionchars = see coscom.org function V00 //CODE_Description_End function coscomgetVersion(portnumber : Integer;versionchars : PCHAR) : Integer; stdcall; //CODE_Description_Begin(coscomgetStatus) // checks the device control status with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // 0 == Stop // 1 == Run // 2 == Pause // 3 == Stopping // 4 == Detecting // 5 == Off //CODE_Description_End function coscomgetStatus(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetDuration) // get the device runtime duration 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = duration in ms // - this duration is the time returned by the coscom function T00 //CODE_Description_End function coscomgetDuration(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetSpeed) // get the device actual speed with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = speed in m/s for treadmills m/min for ladder ergometers // - this speed is the value returned by the coscom function S01 //CODE_Description_End function coscomgetSpeed(portnumber : Integer;value : PDouble) : Integer; stdcall; //CODE_Description_Begin(coscomgetAcceleration) // get the device actual acceleration index with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = acceleration index 0..7 // - this acceleration index is the value returned by the coscom function A01 //CODE_Description_End function coscomgetAcceleration(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetElevation) // get the device actual elevation with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = elevation in % - (height / length) * 100% // - this elevation is the value returned by the coscom function E01 //CODE_Description_End function coscomgetElevation(portnumber : Integer;value : PDouble) : Integer; stdcall; //CODE_Description_Begin(coscomgetHeartrate) // get the device actual heartrate with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = heartrate in beats per minunte // 0 == invalid heartrate value // - this elevation is the value returned by the coscom function P01 //CODE_Description_End function coscomgetHeartrate(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetDistance) // get the device actual distance with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = distance in meters for treadmills / decimetre for ladder ergometer // - this distance is the value returned by the coscom function D00 //CODE_Description_End function coscomgetDistance(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetError) // get the device error status with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = error numbers // - this error numbers are the values returned by the coscom function Z00 //CODE_Description_End function coscomgetError(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetFailSafe) // get the device fail safe time with portnumber 1 .. x //remark: this value is the last value set by the function coscomsetFailSafe // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = 0..25 // - this fail safe time is the value set by the coscom function F00 //CODE_Description_End function coscomgetFailSafe(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetWeight) // get the device Weight with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = 0.. // - this weight is the value returned by the coscom function J00 //CODE_Description_End function coscomgetWeight(portnumber : Integer;value : PInteger) : Integer; stdcall; //CODE_Description_Begin(coscomgetEnergy) // get the device Energy with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = // - this energy is the value returned by the coscom function J01 //CODE_Description_End function coscomgetEnergy(portnumber : Integer;value : PDouble) : Integer; stdcall; //CODE_Description_Begin(coscomgetPower) // get the device Power with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = // - this power is the value returned by the coscom function J02 //CODE_Description_End function coscomgetPower(portnumber : Integer;value : PDouble) : Integer; stdcall; //CODE_Description_Begin(coscomsetFailSafe) // get the device fail safe time with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned parameter values: // returned value value: // value = 0..25 // - this fail safe time is the value set by the coscom function F00 //CODE_Description_End function coscomsetFailSafe(portnumber : Integer;value : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomsetSpeed) // sets the device program speed with portnumber 1 .. x // parameter value: // value = speed in m/s for treadmills m/min for ladder ergometers // - this speed is the value set by the coscom function S02 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomsetSpeed(portnumber : Integer;value : Double) : Integer; stdcall; //CODE_Description_Begin(coscomsetAcceleration) // sets the device program acceleration index with portnumber 1 .. x // parameter value: // value = 0..7 // - this acceleration index is the value set by the coscom function A01 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomsetAcceleration(portnumber : Integer;value : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomsetAcceleration) // this function is the concatenation of the functions coscomsetAcceleration + // coscomsetSpeed //CODE_Description_End function coscomsetSpeedAccel(portnumber : Integer;value : Double;accelerationindex : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomsetElevation) // sets the device program elevation with portnumber 1 .. x // parameter value: // value = elevation in % - (height / length) * 100% // - this elevation is the value set by the coscom function E03 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomsetElevation(portnumber : Integer;value : Double) : Integer; stdcall; //CODE_Description_Begin(coscomKeyPressStart) // sends device key press start command with portnumber 1 .. x // parameter how: // 0 == released // 1 == pressed // - this key press is the value send by the coscom function U10 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomKeyPressStart(portnumber : Integer;how : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomKeyPressStop) // sends device key press stop command with portnumber 1 .. x // parameter how: // 0 == released // 1 == pressed // - this key press is the value send by the coscom function U10 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomKeyPressStop(portnumber : Integer;how : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomKeyPressPlus) // sends device key press + command with portnumber 1 .. x // parameter how: // 0 == released // 1 == pressed // - this key press is the value send by the coscom function U10 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomKeyPressPlus(portnumber : Integer;how : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomKeyPressMinus) // sends device key press - command with portnumber 1 .. x // parameter how: // 0 == released // 1 == pressed // - this key press is the value send by the coscom function U10 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomKeyPressMinus(portnumber : Integer;how : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomKeyPressUp) // sends device key press up command with portnumber 1 .. x // parameter how: // 0 == released // 1 == pressed // - this key press is the value send by the coscom function U10 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomKeyPressUp(portnumber : Integer;how : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomKeyPressDown) // sends device key press down command with portnumber 1 .. x // parameter how: // 0 == released // 1 == pressed // - this key press is the value send by the coscom function U10 // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user //CODE_Description_End function coscomKeyPressDown(portnumber : Integer;how : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomsetProtocol) // this function enables/disables the hardware protocol device with portnumber 1 .. x // parameter how // 0 == off // 1 == on //remark: if switches the protocol on, the dll automatically creates a directory // under the program directory named "Protocol". in this directory an file is opened // with an name with the following format "Protocolyyyymmdd-n.TXT" // yyyy == year // mm == month // dd == day // n == ticks from start of the windows session // a valid example is "Protocol20051214-3910265.TXT" //CODE_Description_End function coscomsetProtocol(portnumber : Integer;how : Integer) : Integer; stdcall; //CODE_Description_Begin(coscomsetProtocol) // returns the device hardware protocol status with portnumber 1 .. x // return value -4 means invalid portnumber // return value -2 means the port is opened but the device cann't be controlled // return value -3 means an error occurred during function call // return value 0 means the port isn't open // return value 1 means the device can controlled by user // returned value how; // 0 == off // 1 == on //CODE_Description_End function coscomgetProtocol(portnumber : Integer;how : PInteger) : Integer; stdcall; implementation function coscomopenPort; external 'coscom.dll'; function coscomclosePort; external 'coscom.dll'; function isvalidCoscomDevice; external 'coscom.dll'; function coscomgetVersion; stdcall; external 'coscom.dll'; function coscomgetStatus; stdcall; external 'coscom.dll'; function coscomgetDuration; stdcall; external 'coscom.dll'; function coscomgetSpeed; stdcall; external 'coscom.dll'; function coscomgetAcceleration; external 'coscom.dll'; function coscomgetElevation; external 'coscom.dll'; function coscomgetHeartrate; external 'coscom.dll'; function coscomgetDistance; external 'coscom.dll'; function coscomgetError; external 'coscom.dll'; function coscomgetFailSafe; external 'coscom.dll'; function coscomsetFailSafe; external 'coscom.dll'; function coscomgetWeight; external 'coscom.dll'; function coscomgetEnergy; external 'coscom.dll'; function coscomgetPower; external 'coscom.dll'; function coscomsetSpeed; external 'coscom.dll'; function coscomsetAcceleration; external 'coscom.dll'; function coscomsetElevation; external 'coscom.dll'; function coscomsetSpeedAccel; external 'coscom.dll'; function coscomKeyPressStart; external 'coscom.dll'; function coscomKeyPressStop; external 'coscom.dll'; function coscomKeyPressPlus; external 'coscom.dll'; function coscomKeyPressMinus; external 'coscom.dll'; function coscomKeyPressUp; external 'coscom.dll'; function coscomKeyPressDown; external 'coscom.dll'; function coscomsetProtocol; external 'coscom.dll'; function coscomgetProtocol; external 'coscom.dll'; end.