HOMEPAGE

Open Source Project RJ10.DLL - Less is More: This does not mean that 'More' is too complicated.

Project Level 1

Developer Plattform

!?

Start and Process Control

Radio Control

IF-In & AF-Out Control
Panorama-View & ExtIQ-Receiver
EEprom & Calibration
Graphical Utillity

RJ10DLL::CheckDeviceChangings

int CheckDeviceChangings( UINT nEventType, DWORD dwData );

Return Value

  • DEVICE_NOT_READY     
  • DEVICE_FIRST_ARIVAL  

  • DEVICE_NOT_FOUND     
  • DEVICE_READY            
  • DEVICE_NOW_READY
  • -100

0
-98
-1
1
2
100

device was not ready
the first messages after program start
the device ist not connected
device found an ready
device is allready connected
this was not a valid message

Parameters

nEventType
An event type. See CWnd::OnDeviceChange the Remarks section for a description

dwData
The address of a structure that contains event-specific data.
Its meaning depends on the given event.

 Remarks

Check device changings by message OnDeviceChange.

If you set nEventType and dwData to the result of OnDeviceChange
and
it is a RadioJet-Message, then one of the following two messages are generated:

WM_HID_JET_ADD
WM_HID_JET_REMOVE

If you set nEventType and dwData to NULL, then you check the device status.
I
f you set nEventType and dwData to -1, then you close device and audio actions
and you get back alltimes DEVICE_NOT_READY.


Example

see on RJ10Mini SourceExample:
CRJ10MiniDlg::DeviceRemoved   and   CRJ10MiniDlg::StartAction


#include <dbt.h>

BEGIN_MESSAGE_MAP(CRJ10MiniDlg, CDialog)
//{{AFX_MSG_MAP(CRJ10MiniDlg)
    ON_WM_DEVICECHANGE()
    ON_MESSAGE(WM_HID_JET_ADD, DeviceAdd)
    ON_MESSAGE(WM_HID_JET_REMOVE, DeviceRemoved)

//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CRJ10MiniDlg::OnDeviceChange( UINT nEventType, DWORD dwData )
{
    CheckDeviceChangings(nEventType,dwData);
    return FALSE;
}

LRESULT CRJ10MiniDlg::DeviceAdd(WPARAM wParam, LPARAM lParam)
{
    LastDeviceCheck=CheckDeviceChangings(0,0);
    if(LastDeviceCheck==DEVICE_READY) return TRUE;

    if(LastDeviceCheck==DEVICE_NOW_READY)
        {
        OpenReceiver(m_hWnd,myDIR,0);
        if(OpenIFInput(m_hWnd,m_IFinpuThread->m_nThreadID))
            {
            ImOpen=1;
            m_IFinpuThread->ResumeThread();
            ActivateIFInput(1);
            }
        }
    return NULL;
}

LRESULT CRJ10MiniDlg::DeviceRemoved(WPARAM wParam, LPARAM lParam)
{
    ImOpen=0;
    LastDeviceCheck=CheckDeviceChangings(-1,-1);
    m_IFinpuThread->SuspendThread();
    ActivateIFInput(0);
    return NULL;
}

See Also   -->  MyPoti.h, MyPoti.cpp, RJ10M-DLL.h
 

   Copyright 2012 © Bonito Germany.   

www.bonito.net