mirror of
https://github.com/meshtastic/meshtastic.git
synced 2024-11-10 23:54:17 -08:00
9dc879235f
* initial devices.json * initial hardware components * testing page at /docs/hardware/supported/template * WIP Changes * Home page work & updates * Fix build * Fix external link button * Setup linting * rename, cleanup & lint * seperate lint cmd for now Co-authored-by: Foster Irwin <foster@jfirwin.com> Co-authored-by: Sacha Weatherstone <sachaw100@hotmail..om>
40 lines
961 B
Plaintext
40 lines
961 B
Plaintext
---
|
|
id: http-api
|
|
title: HTTP API
|
|
sidebar_label: HTTP API
|
|
---
|
|
|
|
:::info
|
|
Methods and types for using the device [HTTP API](http://example.com) are exported
|
|
:::
|
|
|
|
```typescript
|
|
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();
|
|
```
|