Galil DMC32 OSU
 All Files Functions Pages
Dmccom.h File Reference

Go to the source code of this file.

Functions

LONG FAR GALILCALL DMCOpen (USHORT usController, void *hwnd, PHANDLEDMC phdmc)
 Open communications with the Galil controller. More...
 
LONG FAR GALILCALL DMCOpen2 (USHORT usController, LONG lThreadID, PHANDLEDMC phdmc)
 Open communications with the Galil controller. DMCOpen2 is a wrapper around DMCOpen. More...
 
LONG FAR GALILCALL DMCClose (HANDLEDMC hdmc)
 Close communications with the Galil controller. More...
 
LONG FAR GALILCALL DMCCommand (HANDLEDMC hdmc, PSZ pszCommand, LPCHAR pchResponse, ULONG cbResponse)
 Send a DMC command in ascii format to the Galil controller. More...
 
LONG FAR GALILCALL DMCGetUnsolicitedResponse (HANDLEDMC hdmc, LPCHAR pchResponse, ULONG cbResponse)
 Query the Galil controller for unsolicited responses. More...
 
LONG FAR GALILCALL DMCGetAdditionalResponseLen (HANDLEDMC hdmc, LPULONG pulResponseLen)
 Query the Galil controller for the length of additional response data. More...
 
LONG FAR GALILCALL DMCGetAdditionalResponse (HANDLEDMC hdmc, LPCHAR pchResponse, ULONG cbResponse)
 Query the Galil controller for more response data. More...
 
LONG FAR GALILCALL DMCVersion (HANDLEDMC hdmc, LPCHAR pchVersion, ULONG cbVersion)
 Get the version of the Galil controller. More...
 
LONG FAR GALILCALL DMCDownloadFile (HANDLEDMC hdmc, PSZ pszFileName, PSZ pszLabel)
 Download a file to the Galil controller. More...
 
LONG FAR GALILCALL DMCDownloadFromBuffer (HANDLEDMC hdmc, PSZ pszBuffer, PSZ pszLabel)
 Download from a buffer to the Galil controller. More...
 
LONG FAR GALILCALL DMCUploadFile (HANDLEDMC hdmc, PSZ pszFileName)
 Upload a file from the Galil controller. More...
 
LONG FAR GALILCALL DMCUploadToBuffer (HANDLEDMC hdmc, LPCHAR pchBuffer, ULONG cbBuffer)
 Upload to a buffer from the Galil controller. More...
 
LONG FAR GALILCALL DMCArrayDownload (HANDLEDMC hdmc, PSZ pszArrayName, USHORT usFirstElement, USHORT usLastElement, LPCHAR pchData, ULONG cbData, LPULONG cbBytesWritten)
 Download an array to the Galil controller. More...
 
LONG FAR GALILCALL DMCArrayUpload (HANDLEDMC hdmc, PSZ pszArrayName, USHORT usFirstElement, USHORT usLastElement, LPCHAR pchData, ULONG cbData, LPULONG pulBytesRead, SHORT fComma)
 Upload an array from the Galil controller. More...
 
LONG FAR GALILCALL DMCRefreshDataRecord (HANDLEDMC hdmc, ULONG ulLength)
 Refresh the data record used for fast polling. More...
 
LONG FAR GALILCALL DMCGetDataRecordConstPointer (HANDLEDMC hdmc, const char **pchDataRecord)
 Get a const pointer to the most recent data record. More...
 

Detailed Description

OS Upgrade for Dmccom.h. Derived from original Dmccom.h. Comments have been updated and unnecessary code has been commented out.

All functions return an error code. DMCNOERROR (0) indicates function completed successfully. < 0 is a local error (see the error codes below).

Unsupported functions return appropriate errors.

Function Documentation

LONG FAR GALILCALL DMCArrayDownload ( HANDLEDMC  hdmc,
PSZ  pszArrayName,
USHORT  usFirstElement,
USHORT  usLastElement,
LPCHAR  pchData,
ULONG  cbData,
LPULONG  cbBytesWritten 
)

Download an array to the Galil controller.

The array must exist on the controller. Array data can be delimited by a comma or CR (0x0D) or CR/LF (0x0D0A).

Note
The firmware on the controller must be recent enough to support the QD command.
Parameters
hdmcHandle to the Galil controller.
pszArrayNameArray name to download to the Galil controller.
usFirstElementFirst array element.
usLastElementLast array element.
pchDataBuffer to write the array data from. Data does not need to be NULL terminated.
cbDataLength of the array data in the buffer.
cbBytesWrittenNumber of bytes written.
LONG FAR GALILCALL DMCArrayUpload ( HANDLEDMC  hdmc,
PSZ  pszArrayName,
USHORT  usFirstElement,
USHORT  usLastElement,
LPCHAR  pchData,
ULONG  cbData,
LPULONG  pulBytesRead,
SHORT  fComma 
)

Upload an array from the Galil controller.

The array must exist on the controller. Array data will be delimited by a comma or CR (0x0D) depending of the value of fComma.

Note
The firmware on the controller must be recent enough to support the QU command.
Parameters
hdmcHandle to the Galil controller.
pszArrayNameArray name to upload from the Galil controller.
usFirstElementFirst array element.
usLastElementLast array element.
pchDataBuffer to read the array data into. Array data will not be NULL terminated.
cbDataLength of the buffer.
pulBytesReadNumber of bytes read.
fComma0 = delimit by "\r", 1 = delimit by ",".
LONG FAR GALILCALL DMCClose ( HANDLEDMC  hdmc)

Close communications with the Galil controller.

User must call close when done to disconnect from the controller. Failure to do so may result in the failure of future DMCOpen() calls until the controller/PC is reset.

Parameters
hdmcHandle to the Galil controller.
LONG FAR GALILCALL DMCCommand ( HANDLEDMC  hdmc,
PSZ  pszCommand,
LPCHAR  pchResponse,
ULONG  cbResponse 
)

Send a DMC command in ascii format to the Galil controller.

Performs a command-and-response transaction with the hardware.

Parameters
hdmcHandle to the Galil controller.
pszCommandThe command to send to the Galil controller.
pchResponseBuffer to receive the response data. If the buffer is too small to recieve all the response data from the controller, the error code DMCERROR_BUFFERFULL will be returned. The user may get additional response data by calling the function DMCGetAdditionalResponse. The length of the additonal response data may ascertained by calling the function DMCGetAdditionalResponseLen. If the response data from the controller is too large for the internal additional response buffer, the error code DMCERROR_RESPONSEDATA will be returned. Output only.
cbResponseLength of the buffer.
LONG FAR GALILCALL DMCDownloadFile ( HANDLEDMC  hdmc,
PSZ  pszFileName,
PSZ  pszLabel 
)

Download a file to the Galil controller.

Parameters
hdmcHandle to the Galil controller.
pszFileNameFile name to download to the Galil controller.
pszLabelProgram label download destination. This argument is ignored if NULL.
LONG FAR GALILCALL DMCDownloadFromBuffer ( HANDLEDMC  hdmc,
PSZ  pszBuffer,
PSZ  pszLabel 
)

Download from a buffer to the Galil controller.

Parameters
hdmcHandle to the Galil controller.
pszBufferBuffer of DMC commands to download to the Galil controller.
pszLabelProgram label download destination. This argument is ignored if NULL.
LONG FAR GALILCALL DMCGetAdditionalResponse ( HANDLEDMC  hdmc,
LPCHAR  pchResponse,
ULONG  cbResponse 
)

Query the Galil controller for more response data.

There will be more response data available if the DMCCommand function returned DMCERROR_BUFFERFULL. Once this function is called, the internal additonal response buffer is cleared.

Parameters
hdmcHandle to the Galil controller.
pchResponseBuffer to receive the response data. Output only.
cbResponseLength of the buffer.
LONG FAR GALILCALL DMCGetAdditionalResponseLen ( HANDLEDMC  hdmc,
LPULONG  pulResponseLen 
)

Query the Galil controller for the length of additional response data.

There will be more response data available if the DMCCommand function returned DMCERROR_BUFFERFULL.

Parameters
hdmcHandle to the Galil controller.
pulResponseLenBuffer to receive the additional response data length. Output only.
LONG FAR GALILCALL DMCGetDataRecordConstPointer ( HANDLEDMC  hdmc,
const char **  pchDataRecord 
)

Get a const pointer to the most recent data record.

using this method to access the information in the data record eliminates the copying necessary with DMCCopyDataRecord.

Parameters
hdmcHandle to the Galil controller.
pchDataRecordConst pointer to the data record.
LONG FAR GALILCALL DMCGetUnsolicitedResponse ( HANDLEDMC  hdmc,
LPCHAR  pchResponse,
ULONG  cbResponse 
)

Query the Galil controller for unsolicited responses.

Unsolicited messages output from programs running in the background on the Galil controller. The data placed in the user buffer (pchResponse) is NULL terminated.

Parameters
hdmcHandle to the Galil controller.
pchResponseBuffer to receive the response data.
cbResponseLength of the buffer.
LONG FAR GALILCALL DMCOpen ( USHORT  usController,
void *  hwnd,
PHANDLEDMC  phdmc 
)

Open communications with the Galil controller.

The handle to the Galil controller is returned in the argument phdmc.

Parameters
usControllerA number between 1 and 16. Up to 16 Galil controllers may be addressed per process. Maps to "number" attribute of controller tag in registry.xml.
hwndNot used in Windows OS Upgrade version. Maintained to provide argument compatibility with the legacy version.
phdmcBuffer to receive the handle to the Galil controller to be used for all subsequent API calls. Users should declare a variable of type HANDLEDMC and pass the address of the variable to the function. Output only.
LONG FAR GALILCALL DMCOpen2 ( USHORT  usController,
LONG  lThreadID,
PHANDLEDMC  phdmc 
)

Open communications with the Galil controller. DMCOpen2 is a wrapper around DMCOpen.

The handle to the Galil controller is returned in the argument phdmc.

Parameters
usControllerA number between 1 and 16. Up to 16 Galil controllers may be addressed per process. Maps to "number" attribute of controller tag in registry.xml.
lThreadIDNot used in Windows OS Upgrade version. Maintained to provide argument compatibility with the legacy version.
phdmcBuffer to receive the handle to the Galil controller to be used for all subsequent API calls. Users should declare a variable of type HANDLEDMC and pass the address of the variable to the function. Output only.
LONG FAR GALILCALL DMCRefreshDataRecord ( HANDLEDMC  hdmc,
ULONG  ulLength 
)

Refresh the data record used for fast polling.

Parameters
hdmcHandle to the Galil controller.
ulLengthDeprecated, set to zero.
LONG FAR GALILCALL DMCUploadFile ( HANDLEDMC  hdmc,
PSZ  pszFileName 
)

Upload a file from the Galil controller.

Parameters
hdmcHandle to the Galil controller.
pszFileNameFile name to upload from the Galil controller.
LONG FAR GALILCALL DMCUploadToBuffer ( HANDLEDMC  hdmc,
LPCHAR  pchBuffer,
ULONG  cbBuffer 
)

Upload to a buffer from the Galil controller.

Parameters
hdmcHandle to the Galil controller.
pchBufferBuffer of DMC commands to upload from the Galil controller. Output only.
cbBufferLength of the buffer.
LONG FAR GALILCALL DMCVersion ( HANDLEDMC  hdmc,
LPCHAR  pchVersion,
ULONG  cbVersion 
)

Get the version of the Galil controller.

Note
The output of DMCVersion() in the OSU version is NOT identical to the legacy version. The following are examples of the output.
Galil Motion Controller DMC4020 Rev 1.2b (OSU) 192.168.0.43
Galil Motion Controller DMC1846 Rev 1.0c (OSU) GALILPCI1
Galil Motion Controller DMC4020 Rev 1.2b (OSU) COM1
Parameters
hdmcHandle to the Galil controller.
pchVersionBuffer to receive the version information. Output only.
cbVersionLength of the buffer.