Quantcast
Channel: Plantronics Developer Connection: Message List
Viewing all articles
Browse latest Browse all 377

Re: Re: DeviceStateChanged event with value DeviceState_RemovePending on removing device from PC

$
0
0

Hi,Lewis.

 

I've tried on both Lite and Full 2.8.243 Spokes SDK versions.

 

Our integration written on Qt is based on COM C++ code example.

Please find below wrapper for SessionManagerEventHandler:

classSessionManagerEventHandler:publicCComObjectRootEx<CComSingleThreadModel>,publicIDispatch,publicEventHandler

{

private:

     typedefbool(*DeviceCallback)(void);


public:

     voidsetDeviceCallbacks(DeviceCallbackattach,DeviceCallbackdetach)

     {

          attachCallback_=attach;

          detachCallback_=detach;

     }


     BEGIN_COM_MAP(SessionManagerEventHandler)

          COM_INTERFACE_ENTRY(IDispatch)

          COM_INTERFACE_ENTRY_IID(__uuidof(ISessionCOMManagerEvents),IDispatch)

     END_COM_MAP()


     STDMETHOD(DeviceStateChanged)(VARIANTsender,struct_DeviceStateEventArgs*args)

     {

          if(!receiver_)

               returnS_FALSE;

         

          DeviceStatedeviceState;

          args->get_State(&deviceState);


          if(deviceState==DeviceState_Added||deviceState==DeviceState_Removed)

          {

               detachCallback_();

               attachCallback_();

          }


          QEvent*event=newDeviceStateChangedEvent(deviceState,static_cast<QEvent::Type>(DeviceStateChange));

          qApp->postEvent(receiver_,event);


          returnS_OK;

     }

    

     ...


     private:

          DeviceCallbackattachCallback_,detachCallback_;

};

 

deviceState in code example above in both attach/remove device cases equal to DeviceState_RemovePending (4)

 

The bad thing is that SDK C++ COM example shows correct values on the same activity.

Do you have any ideas why I could receive such values in my application? Could the fact that device is also used by application as Sound device influence on this?

 

Regards, Viktor.


Viewing all articles
Browse latest Browse all 377