style: use east const in the C API header

Convert the remaining west-const declarations in xone_api.h to east
const so the whole file matches the controller functions added later.
Update the AGENTS.md C bridge section: east const applies to the C
header too; only trailing returns are exempt.

Co-Authored-By: qwen3.8-27b@q3_k_xl: converted C API header to east const
This commit is contained in:
portersky
2026-08-29 14:31:50 +02:00
parent 1bca6048a5
commit 882b0be827
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -133,8 +133,8 @@ the custom scripts instead of system-installed packages.
- Pure C only: no C++ syntax. The header is imported into Swift via
`-import-objc-header`, so it must compile as C.
- Standard C declaration style; trailing returns and east const do not
apply here.
- Standard C declaration style with east const (e.g. `char const*`);
trailing returns do not apply here.
- Use `stdbool.h` types so Swift sees `Bool`.
## Shell Scripts
+1 -1
View File
@@ -6,7 +6,7 @@ if(NOT CMAKE_GENERATOR MATCHES "^(Ninja|Xcode)$")
endif()
cmake_minimum_required(VERSION 3.21)
project(xone_macos VERSION 0.1.18 LANGUAGES CXX Swift)
project(xone_macos VERSION 0.1.19 LANGUAGES CXX Swift)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+8 -8
View File
@@ -15,7 +15,7 @@ extern "C" {
#endif
// Human-readable version string of the protocol stack.
const char *xone_version(void);
char const *xone_version(void);
// TRUE if an Xbox Wireless Dongle is connected, FALSE otherwise.
bool xone_dongle_present(void);
@@ -41,29 +41,29 @@ xone_dongle *xone_open(void);
// returns 0 once started, -1 if the session is busy or already ready. If
// firmware_path is NULL, the common upstream image
// (firmware/xow_dongle.bin) is used.
int xone_start(xone_dongle *d, const char *firmware_path);
int xone_start(xone_dongle *d, char const *firmware_path);
// Close the session and release the dongle. Waits for any in-progress start.
void xone_close(xone_dongle *d);
// Current session state (XONE_STATE_*).
int xone_state(const xone_dongle *d);
int xone_state(xone_dongle const *d);
// Human-readable error from the last failed operation. Empty string if none.
const char *xone_error(const xone_dongle *d);
char const *xone_error(xone_dongle const *d);
// Product ID of the connected dongle (e.g. 0x02E6).
uint16_t xone_pid(const xone_dongle *d);
uint16_t xone_pid(xone_dongle const *d);
// Chip ID from EFUSE (e.g. 0x7612 for MT7612). 0 if unknown.
uint16_t xone_chip_id(const xone_dongle *d);
uint16_t xone_chip_id(xone_dongle const *d);
// MAC address from EFUSE as "xx:xx:xx:xx:xx:xx". Valid until xone_close().
const char *xone_mac_address(const xone_dongle *d);
char const *xone_mac_address(xone_dongle const *d);
// Build string of the loaded firmware image (e.g. "201703281033____").
// Empty string if the firmware was not loaded. Valid until xone_close().
const char *xone_firmware_build(const xone_dongle *d);
char const *xone_firmware_build(xone_dongle const *d);
// Number of connected controllers.
int xone_controller_count(xone_dongle const *d);