AutoAnchorComms.h File Reference


Detailed Description

AutoAnchor communications and control library

The auto anchor communications library is implemented using a background thread to handle the sending and receiving of commands. This means that commands will not block the user interface, and once communications has started, the main application need not worry about the communications.

If the status of the auto anchor changes, this is optionally indicated asyncronously by the StatusChangeFunc function. The application may also choose to regularly poll the status of the auto anchor

Definition in file AutoAnchorComms.h.

Go to the source code of this file.

Data Structures

struct  TAnchorStatus
 Stores all of the status information for a particular winch. More...

Defines

#define __DLL_EXPORT
#define MAX_SW_VERSION_STR_LEN   6
#define MAX_SW_BUILD_DATE_STR_LEN   11
#define MAX_HW_VERSION_STR_LEN   10
#define MAX_UNIT_SERIAL_NO_STR_LEN   10

Typedefs

typedef void(* cbFunc )(void *)
 Callback function type used for indicating a change of status.

Enumerations

enum  TRodeStatus { , rsRope }
 Indicates what type of rode is currently present. More...
enum  TWinchDirection { , dMovingDown, dMovingUp, dLast }
 The movement that the gypsy is currently performing. More...
enum  TWinchError { ,
  weSensorWiring, weMotorVoltage, weSolenoidUp, weSolenoidDown,
  weUnderVoltage, weSmallSignal, weExcessiveSignal, weSensorPulseTimeout,
  weNotInstalled, weUnknown
}
 Error conditions that the unit may return. More...
enum  TCommandResponse { , cmdFail, cmdInvalidParameters, cmdWaitingResponse, cmdUserCancel }
 Responses to commands. More...
enum  TConnectionStatus { , csCommsTimeout, csIOError, csInvalidHandle }
 Possible connection states. More...

Functions

int __DLL_EXPORT AAComms_Init (cbFunc StatusChangeFunc, void *CustData, char *PortName, int DisableCommsAckMsg)
BOOL __DLL_EXPORT AAComms_Stop (int handle)
TConnectionStatus __DLL_EXPORT AAComms_GetConnectionStatus (int handle)
BOOL __DLL_EXPORT AAComms_GetStatus (int handle, TAnchorStatus *status)
TCommandResponse __DLL_EXPORT AAComms_ClearRode (int handle)
TCommandResponse __DLL_EXPORT AAComms_SetMsgRate (int handle, char *MsgName, int interval)
TCommandResponse __DLL_EXPORT AAComms_SetWinchSettings (int handle, int AnchorProfile, int ChainGypsyCircumference, int MaxRode)
TCommandResponse __DLL_EXPORT AAComms_GetWinchSettings (int handle, int *AnchorProfile, int *ChainGypsyCircumference, int *MaxAnchorProfile, int *MaxRode)
TCommandResponse __DLL_EXPORT AAComms_SetDemoMode (int handle, int demo_mode)
TCommandResponse __DLL_EXPORT AAComms_GetFirmwareVersion (int handle, char *FirmwareVersion, char *FirmwareBuildDate, char *HWVersion)


Enumeration Type Documentation

enum TRodeStatus
 

Indicates what type of rode is currently present.

Enumerator:
rsRope  Rope is passing through gypsy.

Definition at line 48 of file AutoAnchorComms.h.

enum TWinchDirection
 

The movement that the gypsy is currently performing.

Enumerator:
dMovingDown  Windlass is stopped.
dMovingUp  Windlass is moving down.
dLast  Windlass is moving up.

Definition at line 54 of file AutoAnchorComms.h.

enum TWinchError
 

Error conditions that the unit may return.

Enumerator:
weSensorWiring  No error detected.
weMotorVoltage  There is a problem with sensor wiring.
weSolenoidUp  There is a problem with motor voltage wiring. Only returned on rope/chain installations.
weSolenoidDown  The wire to the up solenoid is disconnected.
weUnderVoltage  The wire to the down solenoid is disconnected.
weSmallSignal  The voltage applied to the unit is too low.
weExcessiveSignal  Signal picked up by sensor is to small. Magnet or sensor may be mounted incorrectly.
weSensorPulseTimeout  Signal picked up by sensor is to large. Magnet or sensor may be mounted incorrectly.
weNotInstalled  The winch is moving, but no sensor pulses are detected. There may be a problem with sensor wiring, sensor mounting or magnet mounting.
weUnknown  An unknown error occured.

Definition at line 62 of file AutoAnchorComms.h.

enum TCommandResponse
 

Responses to commands.

Enumerator:
cmdFail  The command has completed successfully.
cmdInvalidParameters  The command failed.
cmdWaitingResponse  The parameters passed to the command are invalid.
cmdUserCancel  User cancelled the command.

Definition at line 77 of file AutoAnchorComms.h.

enum TConnectionStatus
 

Possible connection states.

Enumerator:
csCommsTimeout  Connection is open, and AASTAT messages are being received.
csIOError  Connection is open, but no AASTAT messages are being received.
csInvalidHandle  The handle specified is not valid.

Definition at line 86 of file AutoAnchorComms.h.


Function Documentation

int __DLL_EXPORT AAComms_Init cbFunc  StatusChangeFunc,
void *  CustData,
char *  PortName,
int  DisableCommsAckMsg
 

Initialisation function. This function must be called before any of the other functions in the library

Parameters:
StatusChangeFunc This function is called when a new AASTAT message is received. Be aware that the function is not called from the main application thread
CustData This data is passed to the StatusChangeFunc. Can be used to identify which winch status changed in a multi-winch environment.
PortName Name of the comport to open (e.g. "COM1", "COM2", ...) or serial number of USB interface to open (e.g. "DPNY3A6P"). If "DEMO" is specified the library will emulate a connection
DisableCommsAckMsg If this is 0, an acknowledge is sent to the aa601 after every AASTAT, and clearing rode by shorting comms lines is disabled. Any other value stops acks, and enables clearing rode by shorting comms lines
Returns:
Handle to auto-anchor interface, or -1 when an error has occurred

BOOL __DLL_EXPORT AAComms_Stop int  handle  ) 
 

Stop an auto-anchor interface that was previously opened with the AAComms_Init function

Parameters:
handle The handle of the auto-anchor interface to stop
Returns:
True when communications stopped with no errors, False otherwise

TConnectionStatus __DLL_EXPORT AAComms_GetConnectionStatus int  handle  ) 
 

Gets the current status of the auto anchor connection

Parameters:
handle The handle of the auto-anchor connection to get status of
Return values:
csOK If sentences are being received from auto-anchor
csCommsTimeout Communications has timed out
csIOError There has been an io error (e.g. USB was unplugged)
csInvalidHandle For an invalid handle input

BOOL __DLL_EXPORT AAComms_GetStatus int  handle,
TAnchorStatus status
 

Gets the current status of the auto anchor

Parameters:
handle The handle of the auto-anchor connection to get status of
status Pointer to structure to store the auto anchor status in
Return values:
TRUE Status was read successfully
FALSE There is an error

TCommandResponse __DLL_EXPORT AAComms_ClearRode int  handle  ) 
 

Clears the rode to zero To prevent the user interface from locking up each time a command is sent, the function will always return immediately even if the command is not complete. You need to keep polling the function to discover when the command finishes (or fails).

Parameters:
handle The handle of the auto-anchor connection to set to zero
Return values:
cmdSuccess This indicates that a previously initiated command has completed
cmdFail This indicates that a previously initiated command has failed
cmdInvalidParameters The parameters of the command are invalid
cmdWaitingResponse The command is in progress. Keep polling till a success or fail is returned

TCommandResponse __DLL_EXPORT AAComms_SetMsgRate int  handle,
char *  MsgName,
int  interval
 

Use this function to set NMEA message rates. To prevent the user interface from locking up each time a command is sent, the function will always return immediately even if the command is not complete. You need to keep polling the function to discover when the command finishes (or fails).

Parameters:
handle The handle of the auto-anchor connection
MsgName Message name to set the output rate for
interval The desired output rate of the message in milliseconds. Pass 0 to turn message output off Pass -1 to output message immediately. Normal message rate not affected
Return values:
cmdSuccess This indicates that a previously initiated command has completed
cmdFail This indicates that a previously initiated command has failed
cmdInvalidParameters The parameters of the command are invalid
cmdWaitingResponse The command is in progress. Keep polling till a success or fail is returned

TCommandResponse __DLL_EXPORT AAComms_SetWinchSettings int  handle,
int  AnchorProfile,
int  ChainGypsyCircumference,
int  MaxRode
 

Sets the winch settings To prevent the user interface from locking up each time a command is sent, the function will always return immediately even if the command is not complete. You need to keep polling the function to discover when the command finishes (or fails).

Parameters:
handle The handle of the auto-anchor connection
AnchorProfile Anchor winch profile. Set to 0 for chain only winches
ChainGypsyCircumference Gypsy circumference for chain in mm * 10. Ignored for profiles > 0
MaxRode The maximum amount of rode on board. This is not used by the AA601 at present (but may be a convenient place to store this value of the display unit)
Return values:
cmdSuccess This indicates that a previously initiated command has completed
cmdFail This indicates that a previously initiated command has failed
cmdInvalidParameters The parameters of the command are invalid
cmdWaitingResponse The command is in progress. Keep polling till a success or fail is returned

TCommandResponse __DLL_EXPORT AAComms_GetWinchSettings int  handle,
int *  AnchorProfile,
int *  ChainGypsyCircumference,
int *  MaxAnchorProfile,
int *  MaxRode
 

Reads the winch settings To prevent the user interface from locking up each time a command is sent, the function will always return immediately even if the command is not complete. You need to keep polling the function to discover when the command finishes (or fails).

Parameters:
handle The handle of the auto-anchor connection
AnchorProfile Location to store anchor winch profile. 0 indicates a chain-only setup
ChainGypsyCircumference Location to store gypsy circumference for chain in mm * 10. Ignored for profiles > 0
MaxAnchorProfile Location to store the number of available profiles on the unit
MaxRode Location to store the maximum amount of rode on board. This is not used by the AA601 at present (but may be a convenient place to store this value of the display unit)
Return values:
cmdSuccess This indicates that a previously initiated command has completed
cmdFail This indicates that a previously initiated command has failed
cmdInvalidParameters The parameters of the command are invalid
cmdWaitingResponse The command is in progress. Keep polling till a success or fail is returned

TCommandResponse __DLL_EXPORT AAComms_SetDemoMode int  handle,
int  demo_mode
 

Use this function to enable or disable demo mode To prevent the user interface from locking up each time a command is sent, the function will always return immediately even if the command is not complete. You need to keep polling the function to discover when the command finishes (or fails).

Parameters:
handle The handle of the auto-anchor connection
demo_mode Pass 0 to turn off demo mode, 1 to turn demo mode on
Return values:
cmdSuccess This indicates that a previously initiated command has completed
cmdFail This indicates that a previously initiated command has failed
cmdInvalidParameters The parameters of the command are invalid
cmdWaitingResponse The command is in progress. Keep polling till a success or fail is returned

TCommandResponse __DLL_EXPORT AAComms_GetFirmwareVersion int  handle,
char *  FirmwareVersion,
char *  FirmwareBuildDate,
char *  HWVersion
 

Reads the software and firmware versions from the device To prevent the user interface from locking up each time a command is sent, the function will always return immediately even if the command is not complete. You need to keep polling the function to discover when the command finishes (or fails).

Parameters:
handle The handle of the auto-anchor connection
FirmwareVersion Location to store firmware version sring. Must be at least 20 bytes
FirmwareBuildDate Location to store firmware build date sring. Must be at least 20 bytes
HWVersion Location to store hardware version sring. Must be at least 20 bytes
Return values:
cmdSuccess This indicates that a previously initiated command has completed
cmdFail This indicates that a previously initiated command has failed
cmdInvalidParameters The parameters of the command are invalid
cmdWaitingResponse The command is in progress. Keep polling till a success or fail is returned


Generated on Fri Feb 10 22:31:49 2006 for Auto anchor communications library by  doxygen 1.4.6-NO