1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
10 let libhardware_legacy = (function () {
11 let library = ctypes.open("libhardware_legacy.so");
14 // Load wifi driver, 0 on success, < 0 on failure.
15 load_driver: library.declare("wifi_load_driver", ctypes.default_abi, ctypes.int),
17 // Unload wifi driver, 0 on success, < 0 on failure.
18 unload_driver: library.declare("wifi_unload_driver", ctypes.default_abi, ctypes.int),
20 // Start supplicant, 0 on success, < 0 on failure.
21 start_supplicant: library.declare("wifi_start_supplicant", ctypes.default_abi, ctypes.int),
23 // Stop supplicant, 0 on success, < 0 on failure.
24 stop_supplicant: library.declare("wifi_stop_supplicant", ctypes.default_abi, ctypes.int),
26 // Open a connection to the supplicant, 0 on success, < 0 on failure.
27 connect_to_supplicant: library.declare("wifi_connect_to_supplicant", ctypes.default_abi, ctypes.int),
29 // Close connection to connection to the supplicant, 0 on success, < 0 on failure.
30 close_supplicant_connection: library.declare("wifi_close_supplicant_connection", ctypes.default_abi, ctypes.void_t),
32 // Block until a wifi event is returned, buf is the buffer, len is the max length of the buffer.
33 // Return value is number of bytes in buffer, or 0 if no event (no connection for instance), and < 0 on failure.
34 wait_for_event: library.declare("wifi_wait_for_event", ctypes.default_abi, ctypes.int, ctypes.char.ptr, ctypes.size_t),
36 // Issue a command to the wifi driver. command is the command string, reply will hold the reply, reply_len contains
37 // the maximum reply length initially and is updated with the actual length. 0 is returned on success, < 0 on failure.
38 command: library.declare("wifi_command", ctypes.default_abi, ctypes.int, ctypes.char.ptr, ctypes.char.ptr, ctypes.size_t.ptr),