KRYONOS
Networking & Web Services

REST Client & Wi-Fi

Network diagnostics, Wi-Fi status, HTTP/HTTPS REST client, and direct flash file streaming in KryonOS.

Global Object: Network

The Network object exposes network diagnostics, Wi-Fi management, and an HTTP/HTTPS REST client for remote APIs and firmware downloads.

Firmware network stack source is available in the KryonOS GitHub Repository.


1. Network Diagnostics & Wi-Fi Status

Network.isWiFiConnected()

Returns true if the station interface has an active IP address.

  • Parameters: None
  • Returns: Boolean

Network.getRSSI()

Returns the Received Signal Strength Indicator in dBm.

  • Parameters: None
  • Returns: Integer (e.g. -65).

Network.getIP()

Returns the current IPv4 address string.

  • Parameters: None
  • Returns: String (e.g. "192.168.1.105").

Network.getMAC()

Returns the physical MAC address string.

  • Parameters: None
  • Returns: String (e.g. "24:6F:28:A1:B2:C3").

Network.ping(host, count)

Sends ICMP Echo Requests to verify reachability.

  • Parameters:
    • host (String): Domain name or IP address.
    • count (Integer, optional): Ping packet count (default 3).
  • Returns: Object { success: Boolean, avgTimeMs: Float, lossPercent: Integer }

2. HTTP / HTTPS REST Requests

The client handles TLS handshake and SSL certificates transparently.

Network.httpGet(url, headers)

Sends an HTTP or HTTPS GET request.

  • Parameters:
    • url (String): Fully qualified URL (http:// or https://).
    • headers (Object, optional): Key-value header map.
  • Returns: Object
Response PropertyTypeDescription
statusIntegerHTTP status code (e.g. 200, 404)
bodyStringRaw response payload
headersObjectResponse headers dictionary
// Fetch weather JSON from a REST API
var response = Network.httpGet("https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&current_weather=true");

if (response && response.status === 200) {
  var data = JSON.parse(response.body);
  System.print("Current Temp: " + data.current_weather.temperature + " C");
}

Network.httpPost(url, body, contentType, headers)

Sends an HTTP or HTTPS POST request.

  • Parameters:
    • url (String)
    • body (String or Object)
    • contentType (String, optional, default "application/json")
    • headers (Object, optional)
  • Returns: Object { status: Integer, body: String, headers: Object }
// Post telemetry data to a remote server
var payload = JSON.stringify({
  deviceId: "NODE-88",
  batteryMv: 3850,
  tempC: System.getTemperature()
});

var res = Network.httpPost("https://kryonos.harislab.tech/api/telemetry", payload, "application/json");
System.print("Telemetry server response code: " + res.status);

3. Streaming File Downloads

Network.httpDownload(url, destPath)

Streams large assets (firmware binaries, .bmp images, audio files, 3D meshes) directly from an HTTP/HTTPS server into /local/ or /sd/ storage without loading the entire payload into RAM.

  • Parameters:
    • url (String): Asset download URL.
    • destPath (String): Destination file path (e.g. "/sd/maps/level1.bin").
  • Returns: Boolean (true if completely downloaded and verified).

On this page