mirror of
https://github.com/meshtastic/meshtastic.git
synced 2024-11-13 17:14:25 -08:00
953 B
953 B
id | title | sidebar_label |
---|---|---|
http-api | HTTP API | HTTP API |
:::info Methods and types for using the device HTTP API are exported :::
import {
Client,
Types,
Protobuf,
SettingsManager,
} from "@meshtastic/meshtasticjs";
/**
* Connection method
*/
const client = new Client();
SettingsManager.setDebugMode(Protobuf.LogLevelEnum.DEBUG);
const connection = client.createHTTPConnection();
connection.connect("192.168.x.x");
const restartDevice: Promise<void> = connection.restartDevice();
const getStatistics: Promise<void | Types.WebSPIFFSResponse> = connection.getStatistics();
const getNetworks: Promise<void | Types.WebNetworkResponse> = connection.getNetworks();
const getSPIFFS: Promise<void | Types.WebSPIFFSResponse> = connection.getSPIFFS();
const deleteSPIFFS: Promise<void | Types.WebSPIFFSResponse> = connection.deleteSPIFFS();
const blinkLED: Promise<void | any> = connection.blinkLED();