Home Manual Reference Source Test Repository
public class | source

DriverManager

Class manipulate drivers

DriverManager provides mechanisms to:

  • initialize and configure drivers based on config files,
  • return instance of driver by driver unique identifier,
  • filter drivers by groups,
  • check if driver is available,
  • resolve dependencies and
  • put driver out of order or recover driver if it is possible.

Each driver can be part of one or more of following groups: control, terrain & position.

Method Summary

Public Methods
public

callMethodByGroup(type: *, method: *, params: *)

Get all drivers that can provide specific type of data (or execute specific command) and call method.

public

getDriver(name: *): Object

Get driver instance by driver name

public

Get all drivers that can provide specific type of data.

public

async init()

Initialize all drivers

public

Returns true if driver is available

public

Check if driver is out of order

public

putDriverOutOfOrder(name: *, message: *)

Put driver out of order

Public Methods

public callMethodByGroup(type: *, method: *, params: *) source

Get all drivers that can provide specific type of data (or execute specific command) and call method.

Eg. imagine you have laptop and monitor. If a monitor is not available then your laptop is it totally ok with it, image will be sent only to laptop's monitor. However, if there is a monitor connected to the laptop then laptop will be aware of monitor and it will send an image to monitor too. Your laptop don't really recognize difference between displays, and it communicates between them in very similar way. To sum up, the same is for this method, method will be called to all drivers that are the part of the group.

Params:

NameTypeAttributeDescription
type *

{String} - Data type which driver can provide. Can be: position & terrain.

method *

{String} - Method to be called.

params *

{Array} - Params to be passed to method.

See:

public getDriver(name: *): Object source

Get driver instance by driver name

Params:

NameTypeAttributeDescription
name *

{String} - Driver name, eg. "MotionDriver", or "ModbusDriver".

Return:

Object

Required driver

public getDriversByGroup(type: *): Object source

Get all drivers that can provide specific type of data.

Every driver that can provide a certain type of data has implemented universal mechanism for getting that data from the driver. That is extremely useful for services and in that case services implement only logic for data processing, not mechanisms for data collection from different drivers. Services are in this case also hardware independent.

Params:

NameTypeAttributeDescription
type *

{String} - Data type which driver can provide. Can be: position & terrain.

Return:

Object

List of filtered drivers

public async init() source

Initialize all drivers

public isDriverAvailable(name: *): boolean source

Returns true if driver is available

Params:

NameTypeAttributeDescription
name *

Driver name

Return:

boolean

Is driver available

public isDriverOutOfOrder(name: *): boolean source

Check if driver is out of order

Params:

NameTypeAttributeDescription
name *

{String} - Unique name of a driver

Return:

boolean

public putDriverOutOfOrder(name: *, message: *) source

Put driver out of order

Params:

NameTypeAttributeDescription
name *

{String} - Unique name of a driver

message *

{String} - Describe more why the fault happened