[][src]Crate nsl_duplex_d2_comms_service

Hardware service to allow for communications over a NSL Duplex D2 Radio. This service starts up a communication service to allow transfer of UDP packets over a serial link to and from the radio.

Configuration

The service can be configured in the config.toml with the following fields:

[nsl-duplex-comms-service]
bus = "/dev/ttyUSB0"
ping_freq = 10

[nsl-duplex-comms-service.comms]
max_num_handlers = 10
downlink_ports = [15001]
timeout = 15000
ip = "127.0.0.2"

[nsl-duplex-comms-service.addr]
ip = "127.0.0.1"
port = 8089

The configuration of this service is split into three parts:

Where bus specifies the UART bus the Duplex is on, ping_freq specifies how often the downlink queue should be checked for queueing up pings, ip specifies the service's IP address, and port specifies the port on which the service will be listening for UDP packets.

Running the Service

The service should be started automatically by its init script, but may also be started manually:

$ nsl-duplex-d2-comms-service
NSL Duplex Communications Service starting on /dev/ttyUSB0

If no config file is specified, then the service will look at /home/system/etc/config.toml. An alternative config file may be specified on the command line at run time:

$ nsl-duplex-d2-comms-service -c config.toml

Panics

This service will panic on start if no config sections are found for the service or if the bus parameter is not provided.

GraphQL Schema

Queries

Failed Packets Up

Request number of bad uplink packets

{
    failedPacketsUp: Int!
}

Failed Packets Down

Request number of bad downlink packets

{
    failedPacketsDown: Int!
}

Packets Up

Request number of packets successfully uplinked

{
    packetsUp: Int!
}

Packets Down

Request number of packets successfully downlinked

{
    packetsDown: Int!
}

Errors

Request errors that have occurred

{
    errors: [String]
}

Modem Health

Request current modem health information

{
    modemHealth {
        resetCount: Int!
        currentTime: Int!
        currentRssi: Int!
        connectionStatus: Int!
        globalstarGateway: Int!
        lastContactTime: Int!
        lastAttemptTime: Int!
        callAttemptsSinceReset: Int!
        successfulConnectsSinceReset: Int!
        averageConnectionDuration: Int!
        connectionDurationStdDev: Int!
    }
}

Geolocation

Request current geolocation data

{
    geolocation {
        lon: Float!
        lat: Float!
        time: Int!
        maxError: Int!
    }
}

Request number of files in the downlink queue

{
    downlink_queue_count: Int!
}

Is Alive

Queries the modem's 'is_alive' status

{
    alive: Boolean!
}

Mutations

NoOp

Execute a trivial command against the system

mutation {
    noop: Boolean!
}