# AT+COPS

The AT+COPS command allows users to check mobile carrier status and select carriers automatically or manually. Below is a guide to executing the AT+COPS command under the default Mobile-Data protocol with MMCLI command sets.

{% hint style="info" %}
Please turn the roaming function on before manually selecting the mobile carrier using the AT+COPS command. You can turn on/off mobile roaming under "Network > Interface > Mobile: Edit."
{% endhint %}

## Test Command

The AT+COPS test command returns five parameters, each representing an operator present in the network. Some formats may be unavailable, which means the fields will be empty.

```html
AT+COPS=?
```

{% code title="Response" overflow="wrap" %}

```html
+COPS: (supported <stat>, long <oper>, short <oper>, numeric <oper>s[<Act>])s][,(supported <mode>s), (supported <format>s)])
```

{% endcode %}

> MMCLI Example:
>
> **mmcli -m 2 --command=AT+COPS=?**
>
> +COPS: (2, "VODAFONE-DE", "VODAFONE", "26202", 7),(1, "Telefónica O2", "O2", "26203", 2),(3, "TELEKOM-DEUTSCHLAND", "TELEKOM", "26206", 7)

## Read Command

The AT+COPS read command returns the current mobile carrier and its mode. The format, operator, and access technology parameters are omitted from the response if no operator is connected.

```html
AT+COPS?
```

{% code title="Response" overflow="wrap" %}

```html
+COPS: <mode>[,<format>[,<oper>][,<Act>]]
```

{% endcode %}

> MMCLI Example:
>
> mmcli -m 2 --command=AT+COPS?
>
> +COPS: (2, "VODAFONE-DE", "VODAFONE", "26202", 7)

## Carrier Selection

The AT+COPS write command attempts to select and register with the specified network operator. If the selected operator is unavailable (unless mode 4 of automatic selection is set), no other operator will be selected. The format of the selected operator name will be used for subsequent AT+COPS read commands.

```html
AT+COPS=<mode>[,<format>[,<oper>[,<Act>]]]
```

{% code title="Response" overflow="wrap" %}

```html
''

// If there is any function error, returns:
<err>
```

{% endcode %}

> MMCLI Example of Select by Carrier's **Numbric** ID: \<format> 2
>
> mmcli -m 2 --command=AT+COPS=1,2,26202,7
>
> ' '\
> \
> We can also input the carrier's **short** name: \<format> 1&#x20;
>
> mmcli -m 2 --command=AT+COPS=1,1,Vodafone,7
>
> \
> If select by the carrier's **full** name, expecially when it has space or special characters, such as "-": \<format> 0
>
> mmcli -m 2 --command=AT+COPS=1,0,\\"Vodafone-DE\\",7

## Response Time

When the mobile signal is weak or unstable, the AT+COPS command can take a long time to execute before getting a response. Suggest adding the timeout parameter for test/read/write commands. The typical maximum response time is 180 seconds, determined by the actual mobile network.

> Example of Adding 120-Second Timeout for Test Command
>
> mmcli -m 2 --command=AT+COPS? --timeout=120

## Parameters

<table><thead><tr><th width="143">Parameter</th><th width="154">String / Integer</th><th>Description</th></tr></thead><tbody><tr><td>&#x3C;stat></td><td>0</td><td>Unknown</td></tr><tr><td></td><td>1</td><td>Operator available</td></tr><tr><td></td><td>2</td><td>Current operator</td></tr><tr><td></td><td>3</td><td>Operator forbidden</td></tr><tr><td>&#x3C;oper></td><td>String Type</td><td>Operator in format as per &#x3C;mode>.</td></tr><tr><td>&#x3C;mode></td><td>0</td><td>Automatic mode. field is ignored.</td></tr><tr><td></td><td>1</td><td>Manual operator selection. The field shall be present and optionally.</td></tr><tr><td></td><td>2</td><td>Manually deregister from network.</td></tr><tr><td></td><td>3</td><td>Set only (for AT+COPS? Read Command), and do not attempt registration/deregistration (and fields are ignored). This value is invalid in the response of Read Command.</td></tr><tr><td></td><td>4</td><td>The manual/automatic selection. The field shall be presented. If manual selection fails, automatic mode ( = 0) will be entered.</td></tr><tr><td>&#x3C;format></td><td>0</td><td>Long format alphanumeric, which can be up to 16 characters long.</td></tr><tr><td></td><td>1</td><td>Short format alphanumeric.</td></tr><tr><td></td><td>2</td><td>Numeric . Mobile operators MCC MNC number.</td></tr><tr><td>&#x3C;Act></td><td>Integer Type</td><td>Selected mobile network type. Values 4, 5, and 6 occur only in the response of Read Command, while MS is in a data service state and is not intended for the AT+COPS Write Command.</td></tr><tr><td></td><td>2</td><td>3G - UTRAN</td></tr><tr><td></td><td>4</td><td>3G - UTRAN W/HSDPA</td></tr><tr><td></td><td>5</td><td>3G - UTRAN W/HSUPA</td></tr><tr><td></td><td>6</td><td>3G - UTRAN W/HSDPA and HSUPA</td></tr><tr><td></td><td>7</td><td>4G - E-UTRAN</td></tr><tr><td></td><td>10</td><td>4G - E-UTRAN connected to a 5GCN</td></tr><tr><td></td><td>11</td><td>5G - 5GNR connect to 5GCN</td></tr><tr><td></td><td>12</td><td>5G - NG-RAN</td></tr><tr><td></td><td>13</td><td>4G &#x26; 5G - E-UTRAN_NR dual connectivity</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://how.router.works/dev/command/at-5g/at-cops.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
