CHAILink SDK  Version 1.3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CLC_ErrorCode CHAI_AddLocalDevice ( ObjectTypes  deviceType,
CPUINT16 const  wModelID,
CPUINT32 const  dwDuplicateNumber,
DuplicateModes const  duplicateMode,
CPBOOLEAN const  fHidden,
ExtendedDeviceCapabilities const  extendedCapabilities,
CPCHAR8 const *const  utf8ModelName,
CPUINT32 const  dwDeviceUserData,
CPHOBJECT *const  phDevice 
)

Add a new root device to the CHAI.

Remarks
The returned pointer is related to an object handled by the CHAI; do not delete it! Using this method in connected mode implies usage of CHAI_RedeclareAllDevices()
Parameters
[in]deviceTypeSub-device's type. see ObjectTypes enumeration.
[in]wModelIDmodel ID code
[in]dwDuplicateNumberPreferred duplicate number for DM_Auto mode (might change in case of conflict), or requested number for DM_Fixed mode. Duplicate 0xFFFFFFFF is not allowed. If 0 is provided, a duplicate is automatically assigned by the system and the notification NH_LOCALDEVICE_NOTIFICATION is called with BLDNT_NewDuplicateNumber. Use LocalDevice_GetInfo to retreive the new duplicate A best practice is to store the returned duplicate number and reuse it.
[in]duplicateModeDuplicate resolution mode
[in]fHiddenIndicates if device is hidden or not.
[in]extendedCapabilitiesSub-Device's extended capabilities. See ExtendedDeviceCapabilities enumeration.
[in]utf8ModelNameModel name
[in]dwDeviceUserDataA 32 bit user data associated to the returned device handle. This data will be passed back to the application in Device notifications.
[out]phDevicePointer to the handle of the new local device, or CPHOBJECT_NULL if call failed.
Returns
Standard CHAILink Client return code. See CLC_ErrorCode enumeration.
Remarks
deviceType cannot be AddDevice_VMIDILinkIn, AddDevice_VMIDILinkOut or AddDevice_VMIDILinkHybrid because VMIDILink devices cannot be root devices.
Warning
This function can only be called in CopperLan context. This means in the pseudo task CPDoProcess(), in notification handlers or in asynchronous return handlers and not in SystemDoProcess() for instance.