BeNav5RNC API
Android

Responses and errors

Each command will return a response that may contain an error object in case of error.

  • One command at a time. A command sent while another is still in flight is rejected with -1 busy. Serialise your commands, or wait for each response before sending the next.
  • The id may be sent as a JSON number; it is always returned as a string. Correlate responses with the id you sent.
  • A request whose jsonrpc is not "2.0", or which carries no method, is rejected with -32600 invalid.request.

Success#

json
{
  "jsonrpc": "2.0",
  "result": {},
  "id": "1"
}

Error#

The message is always the error's dotted identifier from the table below, sent verbatim.

json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "method.not.found"
  },
  "id": "1"
}

Generic errors for all RNC commands#

www.jsonrpc.org/specification#error_object

kotlin
EMPTY_LIST(
        -9,
        "empty.list"
    ),
    NULL_PARAMS(
        -8,
        "null.params"
    ),
    APPLICATION_NOT_STARTED(
        -7,
        "application.not.started"
    ),
    NOT_AUTHORIZED_IN_LICENCE(
        -6,
        "not.authorized.in.licence"
    ),
    UNEXPECTED_VARIANT_ERROR(
        -5,
        "unexpected.variant.error"
    ),
    EXCEPTION_CASTING_PARAMS(
        -4,
        "exception.casting.params"
    ),

    /**
     * RNC features are not available in this application
     */
    RNC_NOT_AVAILABLE(
        -3,
        "rnc.not.available"
    ),

    /**
     * The application is not yet ready to handle RNC commands (Core is not initialized)
     */
    APPLICATION_NOT_READY(
        -2,
        "application.not.ready"
    ),

    /**
     * The application is already handling a RNC command, this command is ignored
     */
    BUSY(
        -1,
        "busy"
    ),

    /**
     * An error occurred during Core initialization, application features are not available
     */
    CORE_INIT_ERROR(
        0,
        "core.init.error"
    ),

    /**
     * An error occurred during the json rpc 2.0 parsing
     */
    PARSE_ERROR(
        -32700,
        "parse.error"
    ),

    /**
     * The parsed command is not compliant with json rpc 2.0 standard
     */
    INVALID_REQUEST(
        -32600,
        "invalid.request"
    ),

    /**
     * The command's method is not supported
     */
    UNSUPPORTED_METHOD(
        -32601,
        "method.not.found"
    ),

    /**
     * Parameters of parsed command are invalid
     */
    INVALID_PARAMS(
        -32602,
        "invalid.params"
    ),

    /**
     * Unexpected internal error
     */
    INTERNAL_ERROR(
        -32603,
        "internal.error"
    ),

Error codes

Every command may answer with one of these errors, read from the list above.

CodeMessageMeaning
-9empty.list
-8null.params
-7application.not.started
-6not.authorized.in.licence
-5unexpected.variant.error
-4exception.casting.params
-3rnc.not.availableRNC features are not available in this application
-2application.not.readyThe application is not yet ready to handle RNC commands (Core is not initialized)
-1busyThe application is already handling a RNC command, this command is ignored
0core.init.errorAn error occurred during Core initialization, application features are not available
-32700parse.errorAn error occurred during the json rpc 2.0 parsing
-32600invalid.requestThe parsed command is not compliant with json rpc 2.0 standard
-32601method.not.foundThe command's method is not supported
-32602invalid.paramsParameters of parsed command are invalid
-32603internal.errorUnexpected internal error