2 using the maestro message queue: examples – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 249

Advertising
background image

Method Description

Call Format and Parameters

CheckSubscription: Check the
subscription status

CheckSubscription ([in]DWORD
dwIP,[out]DWORD *pStatus)

dwIP - Maestro device IP address

pStatus – pointer to the DWORD variable to
retrieve the subscription status. When pStatus
= 1, the subscription for the Maestro device is
ready. When pStatus = 0, no subscription is
available for the Maestro device.

14.2 Using the Maestro Message Queue: Examples

This section presents examples of methods that are used to:

• Create an instance of the IMaestroLocator.

• Obtain an instance of the IMessageQueue.

• Verify an IP address.

• Create and cancel a Message Queue subscription.

• Clear the Message Queue and check its size.

• Get a message from the Message Queue.

1. Create an instance of the IMaestroLocator.

CComPtr<IMaestroLocator> spLocator;

HRESULT hr = spLocator.CoCreateInstance( CLSID_MaestroLocator

);

2. Obtain an instance of the IMessageQueue via the CreateMessageQueue method.

bstrName is a unique event name that you create. For example, for the event of a new
Maestro message entering the Message Queue.

CComQIPtr<IMessageQueue> m_queue;

CComBSTR bstrName(_T("MessageQueueEvent")

hr = spLocator-> CreateMessageQueue( bstrName, &m_queue);

Maestro

Software Manual

Maestro Message Queue

MAN-MASSW (Ver. Q)

14-2

Advertising