# BeNav5 RNC API

Drive the BeNav navigation app from your own Android application. Start guidance, manage vehicle profiles, show your own points and zones on its map, and hear back as the trip goes on. Every command is a JSON-RPC 2.0 message carried by an Android Intent.

- [Send a command](https://docs.benomad.com/benav-rnc/sending-commands.md): Put the JSON-RPC message in an Intent: start BeNav's activity with it, or send it as a broadcast to BeNav's receiver.
- [Read the answer](https://docs.benomad.com/benav-rnc/responses-and-errors.md): A command answers with a result, or with an error code from one shared table.
- [Listen to BeNav](https://docs.benomad.com/benav-rnc/receiving-messages.md): Register a receiver for the answers and for the notifications you subscribe to.

## Introduction

![BeNav](https://docs.benomad.com/benav-rnc/images/8eb8c902-5286-4b66-adf4-d03ba0fb0646.png)

The RNC API is designed to act as a bridge between client apps and the Navigation software.

## Commands

What your application asks BeNav to do, grouped by what it acts on.

### Application

- [showApp](https://docs.benomad.com/benav-rnc/commands/show-app.md): Starts the application in the foreground
- [startAppHidden](https://docs.benomad.com/benav-rnc/commands/start-app-hidden.md): Starts the application in the background
- [hideApp](https://docs.benomad.com/benav-rnc/commands/hide-app.md): Puts the application in the background
- [stopApp](https://docs.benomad.com/benav-rnc/commands/stop-app.md): Stops the application and service
- [getAppInfo](https://docs.benomad.com/benav-rnc/commands/get-app-info.md): Retrieves version and licence information
- [lockSettings](https://docs.benomad.com/benav-rnc/commands/lock-settings.md): Locks/unlocks application settings

### Guidance

- [startGuidance](https://docs.benomad.com/benav-rnc/commands/start-guidance.md): Starts navigation with specified points
- [stopGuidance](https://docs.benomad.com/benav-rnc/commands/stop-guidance.md): Stops the current navigation
- [getNavigationProgress](https://docs.benomad.com/benav-rnc/commands/get-navigation-progress.md): Retrieves navigation progress data
- [getRouteOptions](https://docs.benomad.com/benav-rnc/commands/get-route-options.md): Retrieves current route options
- [setRouteOptions](https://docs.benomad.com/benav-rnc/commands/set-route-options.md): Sets new route options

### Vehicle profiles

- [editVehicleProfile](https://docs.benomad.com/benav-rnc/commands/edit-vehicle-profile.md): Creates or modifies a vehicle profile (updated in 2.1.0 to add userPermission)
- [selectVehicleProfile](https://docs.benomad.com/benav-rnc/commands/select-vehicle-profile.md): Selects a vehicle profile
- [getVehicleProfile](https://docs.benomad.com/benav-rnc/commands/get-vehicle-profile.md): Retrieves details of a vehicle profile
- [getVehicleProfilesList](https://docs.benomad.com/benav-rnc/commands/get-vehicle-profiles-list.md): Lists vehicle profiles created via RNC
- [deleteVehicleProfile](https://docs.benomad.com/benav-rnc/commands/delete-vehicle-profile.md): Deletes a vehicle profile
- [displayVehicleProfileOnMap](https://docs.benomad.com/benav-rnc/commands/display-vehicle-profile-on-map.md): Shows or hides the vehicle profile name on the map

### Map

- [showPoi](https://docs.benomad.com/benav-rnc/commands/show-poi.md): Creates PoiStyle from given parameters if it does not exist already and display it on MapView
- [hidePoi](https://docs.benomad.com/benav-rnc/commands/hide-poi.md): Remove specific Poi(s) from MapView, destroy their associated PoiStyle if not in use anymore
- [hideAllPois](https://docs.benomad.com/benav-rnc/commands/hide-all-pois.md): Remove all Pois from MapView and destroy their associated PoiStyle
- [showPolygon](https://docs.benomad.com/benav-rnc/commands/show-polygon.md): Creates PolygonStyle from received parameters if it does not exist already and display it on MapView
- [hidePolygon](https://docs.benomad.com/benav-rnc/commands/hide-polygon.md): Remove specific Polygon(s) from MapView, destroy their associated PolygonStyle if not in use anymore
- [zoomTo](https://docs.benomad.com/benav-rnc/commands/zoom-to.md): Centres the map on a point at a given zoom level (2D, north-up)
- [configureAlerts](https://docs.benomad.com/benav-rnc/commands/configure-alerts.md): Configure traffic signs and vehicle alerts

### Messages and statuses

- [showMessage](https://docs.benomad.com/benav-rnc/commands/show-message.md): Show one message as Notification or Popup If multiple message are sent, they are queued
- [hideMessage](https://docs.benomad.com/benav-rnc/commands/hide-message.md): Hide message
- [updateVehicleStatuses](https://docs.benomad.com/benav-rnc/commands/update-vehicle-statuses.md): Pushes the set of selectable vehicle statuses (id, localised names, icon)
- [setVehicleStatus](https://docs.benomad.com/benav-rnc/commands/set-vehicle-status.md): Forces the current vehicle status by id

### Notifications

- [setupNotifications](https://docs.benomad.com/benav-rnc/commands/setup-notifications.md): Configures notifications to be received

### Circuit navigation

- [startCircuitGuidance](https://docs.benomad.com/benav-rnc/commands/start-circuit-guidance.md)
- [joinCircuit](https://docs.benomad.com/benav-rnc/commands/join-circuit.md): Used to join manually when the vehicle is back on the circuit but too far from where he left it.

## Notifications

What BeNav tells your application as the trip goes on, once you subscribe.

### Navigation and application

- [onNavigationProgressChanged](https://docs.benomad.com/benav-rnc/notifications/on-navigation-progress-changed.md): Notification for changes in navigation progress
- [onViaPointReached](https://docs.benomad.com/benav-rnc/notifications/on-via-point-reached.md): Notification when a waypoint is reached
- [onDestinationReached](https://docs.benomad.com/benav-rnc/notifications/on-destination-reached.md): Notification when the destination is reached
- [onGuidanceStopped](https://docs.benomad.com/benav-rnc/notifications/on-guidance-stopped.md): Notification when navigation is stopped by the user
- [onVehicleProfileAlert](https://docs.benomad.com/benav-rnc/notifications/on-vehicle-profile-alert.md): Notification when a vehicle profile alert is triggered
- [onVehicleStatusChanged](https://docs.benomad.com/benav-rnc/notifications/on-vehicle-status-changed.md): Notification when the current vehicle status changes
- [onAppStatusChanged](https://docs.benomad.com/benav-rnc/notifications/on-app-status-changed.md): Notification when the application starts, is foregrounded, backgrounded or stopped (enabled by default)

### Circuit navigation

- [onCircuitLeft](https://docs.benomad.com/benav-rnc/notifications/on-circuit-left.md): Called when the driver leaves the circuit path.
- [onCircuitJoined](https://docs.benomad.com/benav-rnc/notifications/on-circuit-joined.md): Called when the driver joins the circuit path.
- [onCanJoinCircuit](https://docs.benomad.com/benav-rnc/notifications/on-can-join-circuit.md): Called periodically (every seconds) during FREE\_DRIVE mode when the vehicle is back on the circuit but too far from where he left it.

## Class Diagrams

## General architecture

![General architecture](https://docs.benomad.com/benav-rnc/images/0ffd9c48-b576-45a8-bf48-971b5d7abcfc.png)

## Sequence Diagrams

## Intent Commands

Example with the command `startNav`:

![Intent Commands](https://docs.benomad.com/benav-rnc/images/97455ce2-cec0-4bb9-ab4b-2c80674fc26a.png)
