> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wuji.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Device Parameters and Operations

## handedness (GET)

Get the **handedness** result (left / right).

```python theme={null}
side = hand.handedness().get()   # → "left" or "right"
```

## ip (SET/GET)

**Read and write the device's static IP address**. `set` writes the new IP to the device's flash. The firmware doesn't hot-swap the running Ethernet stack, so the new IP takes effect only after the next reboot. Between `set` and reboot, `get` still returns the current IP.

```python theme={null}
hand.ip().get()                    # read the current IP, e.g. "192.168.1.110"
hand.ip().set("192.168.1.201")     # write to flash, takes effect after reboot
```

The IP must be unique on the subnet. Avoid addresses already used by other devices or the host network adapter.

Changing the IP takes four steps: `set` the new address, `reboot` the device, reconnect at the new IP, and `get` to confirm.

```python theme={null}
hand.ip().set("192.168.1.201")
hand.reboot()
manager.disconnect_all()
# wait for the device to reboot and Ethernet to come up, about 8 seconds
hand = manager.connect(address="192.168.1.201:50001", device_name="wuji_hand_2")
hand.ip().get()                    # → "192.168.1.201"
```

> [!WARNING]
>
> The new IP takes effect only after a reboot. `set` writes to flash without changing the live connection. Before the reboot, `get` still returns the current IP.

## reboot (EXEC)

**Reboot the device**. The device disconnects and needs a fresh connection. Pair it with `ip().set()` to apply a new IP written to flash.

```python theme={null}
hand.reboot()
```

## Enable / Disable / Emergency Stop

```python theme={null}
hand.enable()               # enable all joints
hand.disable()              # disable all joints
hand.enable(joints=mask)    # optional: 0/1 mask of length 20 — acts on joints with a 1
hand.emergency_stop()       # emergency stop: whole-hand action, no mask
```

## clear\_fault (EXEC)

**Clear faults**: a direct action. Without arguments it acts on the whole hand.

```python theme={null}
hand.clear_fault()                  # clear faults on all joints
hand.clear_fault(joints=mask)       # optional: 0/1 mask of length 20 — only joints with a 1 are cleared
```

**Python**

Python: See the Python API examples earlier on this page.

**C**

The C API matches the Python API on this page and uses the `wuji_hand_2_` prefix. For initialization conventions, memory management, error codes, and build setup, see the [C API Reference](https://docs.wuji.tech/docs/en/wuji-sdk/latest/data-reference.md).

### Control Actions (With 20-Joint Mask)

`enable / disable / clear_fault / set_origin / clear_origin` accept an optional `const uint8_t mask[20]`. Pass `NULL` to act on every joint. `emergency_stop` only acts on the whole hand and accepts no mask:

```c theme={null}
// Whole-hand enable
wuji_hand_2_enable(dev, NULL);
// Whole-hand clear faults
wuji_hand_2_clear_fault(dev, NULL);

// Index finger only (flat indices 4..7)
uint8_t mask[20] = {0};
for (int i = 4; i < 8; i++) mask[i] = 1;
wuji_hand_2_enable(dev, mask);            // enable only the 4 index-finger joints
wuji_hand_2_clear_fault(dev, mask);       // clear faults only on the 4 index-finger joints

// Whole-hand emergency stop
wuji_hand_2_emergency_stop(dev);

// User origin
wuji_hand_2_set_origin(dev, NULL);
wuji_hand_2_clear_origin(dev, NULL);
```

### Identity and Diagnostics

```c theme={null}
WujiHandedness side;
wuji_hand_2_get_handedness(dev, &side);   // WUJI_HANDEDNESS_LEFT / _RIGHT

uint8_t n_online;
wuji_hand_2_online_joints_count(dev, &n_online);  // 0..20

// Two-call string getter: first probe with buf=NULL, buf_len=0 to learn the required size
size_t needed = 0;
wuji_hand_2_get_ip(dev, NULL, 0, &needed);
char* ip = malloc(needed);
wuji_hand_2_get_ip(dev, ip, needed, NULL);
printf("ip=%s\n", ip);
free(ip);
```

Write the IP with `wuji_hand_2_set_ip(dev, "192.168.1.201")` and restart the device with `wuji_hand_2_reboot(dev)`. Both take effect exactly as the Python calls do.

`get_hw_version` / `get_comm_diag` return an `out` struct with heap-owned fields. Release with the matching `_free` function after use (only when the call returned `WUJI_STATUS_OK`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.