> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Device

**Header:** `device/inc/Device.h`

## Structures

### `Device`

**Members**

<ParamField path="devObj _(protected)_" type="std::shared_ptr< Device >" />

<ParamField path="mDeviceMutex _(protected)_" type="std::mutex" />

<ParamField path="mPALDeviceName _(protected)_" type="std::string" />

<ParamField path="deviceAttr _(protected)_" type="struct pal_device" />

<ParamField path="rm _(protected)_" type="std::shared_ptr< ResourceManager >" />

<ParamField path="deviceCount _(protected)_" type="int" />

<ParamField path="deviceStartStopCount _(protected)_" type="int" />

<ParamField path="audioRoute _(protected)_" type="struct audio_route *" />

<ParamField path="virtualMixerHandle _(protected)_" type="struct mixer *" />

<ParamField path="hwMixerHandle _(protected)_" type="struct mixer *" />

<ParamField path="mSndDeviceName _(protected)_" type="char" />

<ParamField path="customPayload _(protected)_" type="void *" />

<ParamField path="customPayloadSize _(protected)_" type="size_t" />

<ParamField path="UpdatedSndName _(protected)_" type="std::string" />

<ParamField path="mCurrentPriority _(protected)_" type="uint32_t" />

<ParamField path="mStreamDevAttr _(protected)_" type="std::multimap< uint32_t, std::pair< Stream *, struct pal_device * > >" />

<ParamField path="mSampleRate _(protected)_" type="uint32_t" />

<ParamField path="mBitWidth _(protected)_" type="uint32_t" />

<ParamField path="mInstMutex _(protected)_" type="std::mutex" />

<ParamField path="pm" type="std::shared_ptr< PluginManager >" />

#### Functions

##### `Device`

*protected*

```cpp theme={null}
 Device(struct pal_device *device, std::shared_ptr< ResourceManager > Rm)
```

##### `Device`

*protected*

```cpp theme={null}
 Device()
```

##### `configureDeviceClockSrc`

*protected*

```cpp theme={null}
int32_t configureDeviceClockSrc(char const *mixerStrClockSrc, const uint32_t clockSrc)
```

##### `init`

```cpp theme={null}
int init(pal_param_device_connection_t device_conn)
```

##### `deinit`

```cpp theme={null}
int deinit(pal_param_device_connection_t device_conn)
```

##### `getDefaultConfig`

```cpp theme={null}
int getDefaultConfig(pal_param_device_capability_t capability)
```

##### `open`

```cpp theme={null}
int open()
```

##### `close`

```cpp theme={null}
int close()
```

##### `start`

```cpp theme={null}
int start()
```

##### `start_l`

```cpp theme={null}
int start_l()
```

##### `stop`

```cpp theme={null}
int stop()
```

##### `stop_l`

```cpp theme={null}
int stop_l()
```

##### `prepare`

```cpp theme={null}
int prepare()
```

##### `getSndDeviceId`

```cpp theme={null}
int getSndDeviceId()
```

##### `getDeviceCount`

```cpp theme={null}
int getDeviceCount()
```

##### `getPALDeviceName`

```cpp theme={null}
std::string getPALDeviceName()
```

##### `setDeviceAttributes`

```cpp theme={null}
int setDeviceAttributes(struct pal_device &dattr)
```

##### `getDeviceAttributes`

```cpp theme={null}
int getDeviceAttributes(struct pal_device *dattr, Stream *streamHandle=NULL)
```

##### `getCodecConfig`

```cpp theme={null}
int getCodecConfig(struct pal_media_config *config)
```

##### `updateCustomPayload`

```cpp theme={null}
int updateCustomPayload(void *payload, size_t size)
```

##### `freeCustomPayload`

```cpp theme={null}
int freeCustomPayload(uint8_t **payload, size_t *payloadSize)
```

##### `getCustomPayload`

```cpp theme={null}
void * getCustomPayload()
```

##### `getCustomPayloadSize`

```cpp theme={null}
size_t getCustomPayloadSize()
```

##### `setDeviceParameter`

```cpp theme={null}
int32_t setDeviceParameter(uint32_t param_id, void *param)
```

##### `setParameter`

```cpp theme={null}
int32_t setParameter(uint32_t param_id, void *param)
```

##### `getDeviceParameter`

```cpp theme={null}
int32_t getDeviceParameter(uint32_t param_id, void **param)
```

##### `getParameter`

```cpp theme={null}
int32_t getParameter(uint32_t param_id, void **param)
```

##### `isDeviceReady`

```cpp theme={null}
bool isDeviceReady(pal_device_id_t id)
```

##### `isScoNbWbActive`

```cpp theme={null}
bool isScoNbWbActive()
```

##### `checkAndUpdateSampleRate`

```cpp theme={null}
int32_t checkAndUpdateSampleRate(uint32_t *sampleRate)
```

##### `checkAndUpdateBitWidth`

```cpp theme={null}
int32_t checkAndUpdateBitWidth(uint32_t *bitWidth)
```

##### `selectBestConfig`

```cpp theme={null}
int selectBestConfig(struct pal_device *dattr, struct pal_stream_attributes *sattr, bool is_playback, struct pal_device_info *devinfo)
```

##### `getMaxChannel`

```cpp theme={null}
int getMaxChannel()
```

##### `getHighestSupportedSR`

```cpp theme={null}
int getHighestSupportedSR()
```

##### `isBitWidthSupported`

```cpp theme={null}
int32_t isBitWidthSupported(uint32_t bitWidth)
```

##### `isSupportedSR`

```cpp theme={null}
bool isSupportedSR(int sr)
```

##### `getHighestSupportedBps`

```cpp theme={null}
int getHighestSupportedBps()
```

##### `isDeviceConnected`

```cpp theme={null}
bool isDeviceConnected(struct pal_usb_device_address addr)
```

##### `checkDeviceStatus`

```cpp theme={null}
int32_t checkDeviceStatus()
```

##### `getDeviceConfig`

```cpp theme={null}
int32_t getDeviceConfig(struct pal_device *deviceattr, struct pal_stream_attributes *sAttr)
```

##### `bitsToAlsaFormat`

```cpp theme={null}
unsigned int bitsToAlsaFormat(unsigned int bits)
```

##### `getBeMixerControl`

```cpp theme={null}
struct mixer_ctl * getBeMixerControl(struct mixer *am, std::string beName, uint32_t idx)
```

##### `setCustomPayload`

```cpp theme={null}
int setCustomPayload(std::shared_ptr< ResourceManager > rmHandle, std::string backEndName, void *payload, size_t size)
```

##### `setMediaConfig`

```cpp theme={null}
int setMediaConfig(std::shared_ptr< ResourceManager > rmHandle, std::string backEndName, struct pal_device *dAttr)
```

##### `setSndName`

```cpp theme={null}
void setSndName(std::string snd_name)
```

##### `clearSndName`

```cpp theme={null}
void clearSndName()
```

##### `~Device`

```cpp theme={null}
 ~Device()
```

##### `getCurrentSndDevName`

```cpp theme={null}
void getCurrentSndDevName(char *name)
```

##### `setSampleRate`

```cpp theme={null}
void setSampleRate(uint32_t sr)
```

##### `setBitWidth`

```cpp theme={null}
void setBitWidth(uint32_t bw)
```

##### `lockDeviceMutex`

```cpp theme={null}
void lockDeviceMutex()
```

##### `unlockDeviceMutex`

```cpp theme={null}
void unlockDeviceMutex()
```

##### `compareStreamDevAttr`

```cpp theme={null}
bool compareStreamDevAttr(const struct pal_device *inDevAttr, const struct pal_device_info *inDevInfo, struct pal_device *curDevAttr, const struct pal_device_info *curDevInfo)
```

##### `insertStreamDeviceAttr`

```cpp theme={null}
int insertStreamDeviceAttr(struct pal_device *deviceAttr, Stream *streamHandle)
```

##### `removeStreamDeviceAttr`

```cpp theme={null}
void removeStreamDeviceAttr(Stream *streamHandle)
```

##### `getTopPriorityDeviceAttr`

```cpp theme={null}
int getTopPriorityDeviceAttr(struct pal_device *deviceAttr, uint32_t *streamPrio)
```

##### `isPluginDevice`

```cpp theme={null}
bool isPluginDevice(pal_device_id_t id)
```

##### `isDpDevice`

```cpp theme={null}
bool isDpDevice(pal_device_id_t id)
```

##### `isPluginPlaybackDevice`

```cpp theme={null}
bool isPluginPlaybackDevice(pal_device_id_t id)
```

##### `getInstance`

```cpp theme={null}
std::shared_ptr< Device > getInstance(struct pal_device *device, std::shared_ptr< ResourceManager > Rm)
```

##### `palToSndDriverFormat`

```cpp theme={null}
unsigned int palToSndDriverFormat(uint32_t fmt_id)
```

##### `initHdrRoutine`

```cpp theme={null}
int32_t initHdrRoutine(const char *hdr_custom_key)
```

## Macros

### `DEVICE_NAME_MAX_SIZE`

```c theme={null}
#define DEVICE_NAME_MAX_SIZE 128
```

### `DUMP_DEV_ATTR`

```c theme={null}
#define DUMP_DEV_ATTR 0
```

### `DEFAULT_OUTPUT_CHANNEL`

```c theme={null}
#define DEFAULT_OUTPUT_CHANNEL 2
```
