Inital move (minus WIP tests)
This commit is contained in:
52
modules/clientObjectDefinitions.mjs
Normal file
52
modules/clientObjectDefinitions.mjs
Normal file
@@ -0,0 +1,52 @@
|
||||
import { getAllPresets } from "./radioPresetHandler.mjs";
|
||||
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config()
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export class ClientNodeObject {
|
||||
/**
|
||||
*
|
||||
* @param {string} param0._nuid The ID of the node (Assigned by the client on first boot)
|
||||
* @param {string} param0._name The name of the node (Assigned by the user)
|
||||
* @param {string} param0._location The physical location of the node (Assigned by the user)
|
||||
* @param {object} param0._capabilities The capabilities of this node (Assigned by the user, and determined by the hardware)
|
||||
*/
|
||||
constructor({ _nuid = undefined, _name = undefined, _location = undefined, _capabilities = undefined }) {
|
||||
this.nuid = _nuid;
|
||||
this.name = _name;
|
||||
this.location = _location;
|
||||
this.capabilities = _capabilities
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** The configuration object for the node */
|
||||
export class ClientNodeConfig {
|
||||
/**
|
||||
*
|
||||
* @param {string} param0._nuid The ID of the node (Assigned by the client on first boot)
|
||||
* @param {string} param0._name The name of the node (Assigned by the user)
|
||||
* @param {string} param0._location The physical location of the node (Assigned by the user)
|
||||
* @param {object} param0._nearbySystems An object array of nearby systems (Assigned by the user)
|
||||
* @param {object} param0._capabilities The capabilities of this node (Assigned by the user, and determined by the hardware)
|
||||
*/
|
||||
constructor({
|
||||
_nuid = process.env.CLIENT_NUID,
|
||||
_name = process.env.CLIENT_NAME,
|
||||
_location = process.env.CLIENT_LOCATION,
|
||||
_nearbySystems = getAllPresets(),
|
||||
_capabilities = process.env.CLIENT_CAPABILITIES.split(", "),
|
||||
_serverIp = process.env.SERVER_IP,
|
||||
_serverPort = process.env.SERVER_PORT,
|
||||
}) {
|
||||
this.node = new ClientNodeObject({
|
||||
_nuid: _nuid, _name: _name, _location: _location, _capabilities: _capabilities
|
||||
});
|
||||
this.nearbySystems = _nearbySystems;
|
||||
this.serverIp = _serverIp;
|
||||
this.serverPort = _serverPort;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user