Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@betaflight/api-server

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betaflight/api-server

A GraphQL server to retreive data from betaflight flight controllers

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

@betaflight/api-server

Betaflight in a graph

A GraphQL server for querying, and mutatating betaflight flight controllers

Try it out!

Usage

$ yarn add @betaflight/api-server graphql@14
import { createServer } from "@betaflight/api-server";

createServer().listen({ port: 9000 })

Then, you can query the graph at http://localhost:9000/graphql

Mocked mode

Mocked mode simulates a device and USB ports instead of actually connecting to them. This way, software can be developed without having to have a flight controller to hand.

import { createServer } from "@betaflight/api-server";

// Start in mocked mode
createServer({ mocked: true }).listen({ port: 9000 })

Ports


query Ports {
    ports
}

Connecting

mutation Connect($port: String!) {
    connect(port: $port, baudRate: 115200) {
        id # the connectionId
        apiVersion # the api version of the flight controller
    }
}

Listen for connection changes

subscription OnChanged($id: ID!) {
    onConnectionChanged(connection: $id)
}

Querying

query Attitude($connection: ID!) {
    connection(connectionId: $connection) {
        device {
            attitude {
                roll
                pitch
                heading
            }
        }
        bytesRead
        bytesWritten
        packetErrors
    }
}

For more usage examples, please refer to @betaflight/configurator which uses this package to communicate with flight controllers

Why?

GraphQL is a powerful langauge, and this structure would have had to be implemented in the configurator for client state anyway. Splitting the flight controller graph into it's own API means we both create a segregated architecture for the configurator and allow other people to use the API for other means.

Keywords

FAQs

Package last updated on 11 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc