Client

Client

Represents a client device

Constructor

new Client(configManager, clientId)

Initialize a new Client from the configuration file. If the file does not exist it'll be created. Any deviations will error out.
Source:
Parameters:
Name Type Description
configManager ConfigurationManager ConfigurationManager instance
clientId string Unique id of the client (this will be used as a part of the config file name)

Members

batteryChargerType :string

Charger type reported by the client (ac, discharging, etc)
Source:
Type:
  • string

batteryLevel :number

Current battery level
Source:
Type:
  • number

batteryTemperature :number

Battery temperature reported by the client in terms of degrees C
Source:
Type:
  • number

batteryTimeRemaining :number

Battery charge time remaining reported by the client in seconds.
Source:
Type:
  • number

eventEmitter :EventEmitter

Event emitter
Source:
Type:

isConnected

Whether this client has connected and is connected.
Source:

Methods

getBattery() → {void}

Get the client's battery info. Is should be noted, this only _requests_ the battery data. Battery data will be processed by the request handler.
Source:
Returns:
Type:
void

getClipboard() → {void}

Get the client's clipboard. Is should be noted, this only _requests_ the clipboard data. Clipboard data will be processed by the request handler.
Source:
Returns:
Type:
void

getConInitUUID() → {string}

Returns the conInitUUID
Source:
Returns:
Type:
string

getSecret()

For connection manager
Source:

getSocketUUID() → {string}

Returns the socketUUID
Source:
Returns:
Type:
string

ping() → {Promise.<PingData>}

Send ping packet, return delay
Source:
Returns:
Type:
Promise.<PingData>
Delay in MS

receiveNotification(notification)

ConnectionManager received notification data, push this to the NotificationManager
Source:
Parameters:
Name Type Description
notification Notification Notification received

sendClipboard() → {void}

Send out clipboard over to the client.
Source:
Returns:
Type:
void

sendFile(filePath) → {boolean}

Request that the client downloads a file.
Source:
Parameters:
Name Type Description
filePath string File to send
Returns:
Type:
boolean

sendRequest(command, data)

Send a request (or response) to the client. (connectionManager.sendRequest)
Source:
Parameters:
Name Type Description
command string The client endpoint to send to.
data object Data to send (will be converted to Json).

setupConnectionManager(secret, miscData)

Called after a socket has been opened with this client
Source:
Parameters:
Name Type Description
secret Buffer Shared secret key
miscData object Misc data, such as the createdAt date

syncConfiguration(isResponseopt)

Send configuration settings to the client device. Sync the config.
Source:
Parameters:
Name Type Attributes Default Description
isResponse boolean <optional>
false Whether this is in response to the get configuration request.

unpair() → {boolean}

This will unpair a client
Source:
Returns:
Type:
boolean
True if unpair request sent, or false if already unpaired

updateNotification(notification, metaData) → {boolean}

This will send the Notification ??
Source:
Parameters:
Name Type Description
notification Notification Notification to update
metaData UpdateNotificationData Actions preformed on notification
Returns:
Type:
boolean