//--------------------------------------------------------------------------- #ifndef coscom_vc_1_2H #define coscom_vc_1_2H //--------------------------------------------------------------------------- //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 //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 //extern "C" int __stdcall coscomopenPort(int portnumber); //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 //extern "C" int __stdcall coscomclosePort(int portnumber); //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 //extern "C" int __stdcall isvalidCoscomDevice(int portnumber); //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 //extern "C" int __stdcall coscomgetVersion(int portnumber, char * versionchars); //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 //extern "C" int __stdcall coscomgetStatus(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetDuration(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetSpeed(int portnumber, double * value); //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 //extern "C" int __stdcall coscomgetAcceleration(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetElevation(int portnumber, double * value); //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 //extern "C" int __stdcall coscomgetHeartrate(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetDistance(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetError(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetFailSafe(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetWeight(int portnumber, int *value); //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 //extern "C" int __stdcall coscomgetEnergy(int portnumber, double * value); //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 //extern "C" int __stdcall coscomgetPower(int portnumber, double * value); //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 //extern "C" int __stdcall coscomsetFailSafe(int portnumber, int value); //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 //extern "C" int __stdcall coscomsetSpeed(int portnumber, double value); //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 //extern "C" int __stdcall coscomsetAcceleration(int portnumber, int value); //CODE_Description_Begin(coscomsetAcceleration) // this function is the concatenation of the functions coscomsetAcceleration + // coscomsetSpeed //CODE_Description_End //extern "C" int __stdcall coscomsetSpeedAccel(int portnumber, double value, int accelerationindex); //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 //extern "C" int __stdcall coscomsetElevation(int portnumber, double value); //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 //extern "C" int __stdcall coscomKeyPressStart(int portnumber, int how); //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 //extern "C" int __stdcall coscomKeyPressStop(int portnumber, int how); //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 //extern "C" int __stdcall coscomKeyPressPlus(int portnumber, int how); //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 //extern "C" int __stdcall coscomKeyPressMinus(int portnumber, int how); //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 //extern "C" int __stdcall coscomKeyPressUp(int portnumber, int how); //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 //extern "C" int __stdcall coscomKeyPressDown(int portnumber, int how); //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 //extern "C" int __stdcall coscomsetProtocol(int portnumber, int how); //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 //extern "C" int __stdcall coscomgetProtocol(int portnumber, int *how); #define DefCoscomDLLName "coscom.dll" typedef int (__stdcall *TCOSCOMFUNC)(int); typedef int (__stdcall *TCOSCOMGETPCHARFUNC)(int,char *); typedef int (__stdcall *TCOSCOMGETDOUBLEFUNC)(int,double *); typedef int (__stdcall *TCOSCOMGETINTEGERFUNC)(int,int *); typedef int (__stdcall *TCOSCOMSETDOUBLEFUNC)(int,double); typedef int (__stdcall *TCOSCOMSETINTEGERFUNC)(int,int); typedef int (__stdcall *TCOSCOMSETSPEEDACCELFUNC)(int,double,int); typedef int (__stdcall *TCOSCOMBUTTONFUNC)(int,int); extern HINSTANCE CoscomDLLHandle; extern char CoscomDLLName[260]; extern TCOSCOMFUNC coscomopenPort; extern TCOSCOMFUNC coscomclosePort; extern TCOSCOMGETPCHARFUNC coscomgetVersion; extern TCOSCOMGETINTEGERFUNC coscomgetStatus; extern TCOSCOMGETINTEGERFUNC coscomgetDuration; extern TCOSCOMGETDOUBLEFUNC coscomgetSpeed; extern TCOSCOMGETINTEGERFUNC coscomgetAcceleration; extern TCOSCOMGETDOUBLEFUNC coscomgetElevation; extern TCOSCOMGETINTEGERFUNC coscomgetHeartrate; extern TCOSCOMGETINTEGERFUNC coscomgetDistance; extern TCOSCOMGETINTEGERFUNC coscomgetError; extern TCOSCOMSETDOUBLEFUNC coscomsetSpeed; extern TCOSCOMSETINTEGERFUNC coscomsetAcceleration; extern TCOSCOMSETDOUBLEFUNC coscomsetElevation; extern TCOSCOMSETSPEEDACCELFUNC coscomsetSpeedAccel; extern TCOSCOMBUTTONFUNC coscomKeyPressStart; extern TCOSCOMBUTTONFUNC coscomKeyPressStop; extern TCOSCOMBUTTONFUNC coscomKeyPressPlus; extern TCOSCOMBUTTONFUNC coscomKeyPressMinus; extern TCOSCOMBUTTONFUNC coscomKeyPressUp; extern TCOSCOMBUTTONFUNC coscomKeyPressDown; extern TCOSCOMSETINTEGERFUNC coscomsetFailSafe; extern TCOSCOMGETINTEGERFUNC coscomgetFailSafe; bool __stdcall vc_loadcoscomDLL(); bool __stdcall vc_unloadcoscomDLL(); #endif