beautypg.com

ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 250

background image

3. Verify an IP address.

typedef union IP_CONVERT

{

DWORD

dw;

BYTE bt[4];

}

IP_CONVERT; //IP Address converting

CString sIP;

sIP.Format(_T("%u.%u.%u.%u"), _IP.bt[3], _IP.bt[2], _IP.bt[1],

_IP.bt[0]);

long lIP = 0;

spLocator->IsPresentMaestro(CComBSTR(sIP), &lIP);

if( _IP.dw == (DWORD)lIP )

{//IP successfully verified

}

else

{//failure

}

4. Create a subscription via the Subscribe method. dwIP is the DWORD variable with

the Maestro IP address.

HRESULT hr = m_queue->Subscribe(dwIP);

5. Cancel the subscription via the Unsubscribe method. dwIP is the DWORD variable

with the Maestro IP address.

HRESULT hr = m_queue->Unsubscribe(dwIP);

6. Clear the Message Queue via the MessageQueueErase method.

HRESULT hr = m_queue->MessageQueueErase();

7. Obtain the Message Queue Size via the MessageQueueSize method.

DWORD dwSize=0;

HRESULT hr = m_queue->MessageQueueSize(&dwSize);

8. Obtain a Maestro Message via the ReadMessage method.

DWORD dwIP, dwID, dwWParam, dwLParam, dwTime;

HRESULT hr = m_queue->ReadMessage(&dwIP, &dwID, &dwWParam,

&dwLParam, &dwTime);

Maestro

Software Manual

Maestro Message Queue

MAN-MASSW (Ver. Q)

14-3