> ## 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.

# AR Osal Log Pkt Op

> Defines platform agnostic APIs for sending log packets to the PC.

**Header:** `ar_osal/api/ar_osal_log_pkt_op.h`

## Structures

### `ar_log_pkt_op_init_info_t`

**Members**

<ParamField path="data_transport" type="ar_log_data_transport_t">
  The data transport to use when sending log packets.
</ParamField>

<ParamField path="heap_info" type="ar_heap_info">
  Heap information used to identify memory allocated by the data transport.
</ParamField>

## Functions

### `ar_log_pkt_op_init`

ar\_log\_pkt\_op\_init

```cpp theme={null}
int32_t ar_log_pkt_op_init(ar_log_pkt_op_init_info_t *info)
```

**Parameters**

<ParamField path="info" type="ar_log_pkt_op_init_info_t *">
  pointer to info structure containing heap and data transport information that is used to initialize the pai
</ParamField>

**Returns**

Success  0 Failure  non-zero

### `ar_log_pkt_op_deinit`

ar\_log\_pkt\_op\_deinit

Deinitializes the utility and release any/all
resources aquired
\depends ar\_log\_pkt\_op\_init(...) must be called before this function

```cpp theme={null}
int32_t ar_log_pkt_op_deinit(void)
```

**Returns**

Success  returns a pointer to the allocated memory Failure  returns null if the allocation fails

### `ar_log_pkt_get_max_size`

ar\_log\_pkt\_get\_max\_size

Retrieve the max size of a log packet that can be sent through
the data transport
\depends ar\_log\_pkt\_op\_init(...) must be called before this function

```cpp theme={null}
uint32_t ar_log_pkt_get_max_size(void)
```

**Returns**

return the max log packet size

### `ar_log_pkt_alloc`

ar\_log\_pkt\_alloc

```cpp theme={null}
void * ar_log_pkt_alloc(uint16_t logcode, uint32_t length)
```

**Parameters**

<ParamField path="logcode" type="uint16_t">
  the log code used for the packet. See ar\_util\_data\_log\_codes.h in the AR Util
</ParamField>

<ParamField path="length" type="uint32_t">
  the size of the packet to allocate
</ParamField>

**Returns**

Success  returns a pointer to the allocated memory Failure  returns null if the allocation fails

### `ar_log_pkt_commit`

ar\_log\_pkt\_commit

```cpp theme={null}
int32_t ar_log_pkt_commit(void *ptr)
```

**Parameters**

<ParamField path="ptr" type="void *">
  pointer to memory allocated through ar\_log\_pkt\_alloc
</ParamField>

**Returns**

Success  0 Failure  non-zero

### `ar_log_pkt_free`

ar\_log\_pkt\_free

```cpp theme={null}
void ar_log_pkt_free(void *ptr)
```

**Parameters**

<ParamField path="ptr" type="void *">
  pointer to memory allocated through ar\_log\_pkt\_alloc
</ParamField>

**Returns**

n/a

### `ar_log_code_status`

ar\_log\_code\_status

```cpp theme={null}
bool_t ar_log_code_status(uint16_t logcode)
```

**Parameters**

<ParamField path="logcode" type="uint16_t">
  the log code to check. See ar\_util\_data\_log\_codes.h in the AR Util
</ParamField>

**Returns**

TRUE  ENABLED FALSE  DISABLED

## Type Definitions

### `ar_log_data_transport_t`

An enumeration of supported transports

```cpp theme={null}
typedef enum ar_log_data_transport_t ar_log_data_transport_t
```

### `ar_log_pkt_op_init_info_t`

```cpp theme={null}
typedef struct ar_log_pkt_op_init_info_t ar_log_pkt_op_init_info_t
```

### `par_log_pkt_op_init_info_t`

```cpp theme={null}
typedef struct ar_log_pkt_op_init_info_t * par_log_pkt_op_init_info_t
```

## Enumerations

### `ar_log_data_transport_t`

An enumeration of supported transports

#### Values

| Name                            | Value | Description |
| ------------------------------- | ----- | ----------- |
| `AR_LOG_DATA_TRANSPORT_UNKNOWN` | = 0x0 |             |
| `AR_LOG_DATA_TRANSPORT_DIAG`    | = 0x1 |             |
| `AR_LOG_DATA_TRANSPORT_TCPIP`   | = 0x2 |             |
