Пример #1
0
        //=========================================================
        // CONASearchDevices 
        //
        // Description:
        //	CCONASearchDevices functions search all devices from the target media. 
        //  The target media that can be used is Bluetooth at the moment.
        //
        //  CONASearchDevices allocates and sets devices information to 
        //  CONAPI_CONNECTION_INFO structs and returns pointer to structs.  
        //  Connectivity API-user MUST releases the returned pointer by calling the 
        //  CONAFreeConnectionInfoStructures function. 
        //
        //	Every CONAPI_CONNECTION_INFO struct includes the media and device information.
        //	The struct's dwState parameter defines the paired and trusted information from 
        //  device. It has the following values:
        //  Parameter value					Description					Macros for check the values 
        //																(If value is true, macro returns 1)
        //	CONAPI_DEVICE_UNPAIRED			Device in not paired.		CONAPI_IS_DEVICE_UNPAIRED(dwState)
        //	CONAPI_DEVICE_PAIRED			Device is paired.			CONAPI_IS_DEVICE_PAIRED(dwState)
        //	CONAPI_DEVICE_PCSUITE_TRUSTED	Device is PC Suite trusted.	CONAPI_IS_PCSUITE_TRUSTED(dwState)
        //
        //	Connectivity API can add more values afterwards so Connectivity API-user should 
        //	always use defined macros to check those values!

        //
        // Parameters:
        //	hDMHandle				[in] Existing device management handle.
        //	dwSearchOptions			[in] Search options values:
        //			API_MEDIA_BLUETOOTH: Get devices from bluetooth media. 
        //				This value must be used.
        //			CONAPI_ALLOW_TO_USE_CACHE: Get all devices from cache if available. 
        //				If cache is not available function fails with error: ECONA_CACHE_IS_NOT_AVAILABLE.
        //				This value is optional and can be used with other values.
        //			One of the next values can be used at the time:
        //			CONAPI_GET_ALL_PHONES: Get all phones from target media. Includes unpaired, 
        //				paired and PC Suite trusted phones. 
        //			CONAPI_GET_PAIRED_PHONES:Get all paired phones from target media. Includes 
        //				paired (and PC Suite trusted) phones. 
        //			CONAPI_GET_TRUSTED_PHONES:Get all PC Suite trusted phones from target media. 
        //				Includes all PC Suite trusted phones, which are paired.
        //	dwSearchTime			[in]  Maximum search time in seconds. Note: Bluetooth device
        //			discovery can takes several minutes if there are a lot of devices on range!
        //	pfnSearchNotify			[in]  Pointer to search notification callback function. Value
        //			can be NULL if notification is not needed.
        //	pdwNumberOfStructures	[out] Number of CONAPI_CONNECTION_INFO structures. 
        //	ppConnInfoStructures	[out] Pointer to CONAPI_CONNECTION_INFO structure(s). 

        //	hDMHandle			[in] Device manager handle
        //	pstrSerialNumber	[in] Serial number of the device.
        //	pstrNewFriendlyName [in] New Device Friendly Name .
        //
        // Return values:
        // CONA_OK
        // ECONA_INVALID_POINTER
        // ECONA_INVALID_HANDLE
        // ECONA_DEVICE_NOT_FOUND
        // ECONA_FAILED_TIMEOUT
        // ECONA_NO_CONNECTION_VIA_MEDIA
        // ECONA_MEDIA_IS_NOT_WORKING
        // ECONA_CACHE_IS_NOT_AVAILABLE
        // ECONA_SUSPEND
        // ECONA_NOT_ENOUGH_MEMORY
        // ECONA_NOT_INITIALIZED
        // ECONA_NOT_SUPPORTED_PC
        // ECONA_CANCELLED
        // ECONA_UNKNOWN_ERROR

        //=========================================================
        public static extern int CONASearchDevices(
            int hDMHandle,
            int dwSearchOptions,
            int dwSearchTime,
            CONADefinitions.SearchCallbackDelegate pfnSearchNotify,
            ref int pdwNumberOfStructures,
            ref System.IntPtr pConnInfoStructures
            );
Пример #2
0
        //=========================================================

        //=========================================================
        // CONARegisterNotifyCallback
        //
        // Description:
        //  Registers notification call back function to connectivity API
        //
        // Parameters:
        //  hDMHandle       [in] Device manager handle
        //  iState          [in] Used to define the action
        //                       API_REGISTER used in registeration
        //                       API_REGISTER used in removing the registeration
        //  pfnNotify       [in] Function pointer of the call back method
        //
        // Return values:
        // CONA_OK
        // ECONA_INVALID_POINTER
        // ECONA_INVALID_PARAMETER
        // ECONA_NOT_INITIALIZED
        // ECONA_UNKNOWN_ERROR
        //
        //=========================================================
        public static extern int CONARegisterNotifyCallback(
            int hDMHandle,
            int iState,
            CONADefinitions.DeviceNotifyCallbackDelegate pfnNotify
            );