Skip to content

Commit

Permalink
13.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
unematiii committed Jul 19, 2021
1 parent 2652633 commit bf12799
Show file tree
Hide file tree
Showing 16 changed files with 420 additions and 18 deletions.
4 changes: 1 addition & 3 deletions commands/generateDocumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ const DOCUMENTATION_DIRECTORY = path.resolve(__dirname, '../docs/yml');
*/
async function buildDocumentation() {
const supportedCapabilities = Object.values(Capabilities).filter(
capabilityConf =>
!(capabilityConf.disabled_in || []).includes('web') &&
!['failure_message'].includes(capabilityConf.name)
capabilityConf => !['failure_message'].includes(capabilityConf.name)
);

await Promise.all(
Expand Down
25 changes: 25 additions & 0 deletions docs/yml/capabilityManifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
name_cased: crash
name_pretty: Crash
src: /docs/yml/crash.yml
-
name: cruise_control
name_cased: cruiseControl
name_pretty: 'Cruise Control'
src: /docs/yml/cruise_control.yml
-
name: dashboard_lights
name_cased: dashboardLights
Expand All @@ -53,6 +58,11 @@
name_cased: doors
name_pretty: Doors
src: /docs/yml/doors.yml
-
name: driver_fatigue
name_cased: driverFatigue
name_pretty: 'Driver Fatigue'
src: /docs/yml/driver_fatigue.yml
-
name: engine
name_cased: engine
Expand All @@ -73,6 +83,11 @@
name_cased: graphics
name_pretty: Graphics
src: /docs/yml/graphics.yml
-
name: heart_rate
name_cased: heartRate
name_pretty: 'Heart Rate'
src: /docs/yml/heart_rate.yml
-
name: historical
name_cased: historical
Expand All @@ -98,6 +113,11 @@
name_cased: ignition
name_pretty: Ignition
src: /docs/yml/ignition.yml
-
name: keyfob_position
name_cased: keyfobPosition
name_pretty: 'Keyfob Position'
src: /docs/yml/keyfob_position.yml
-
name: light_conditions
name_cased: lightConditions
Expand Down Expand Up @@ -163,6 +183,11 @@
name_cased: race
name_pretty: Race
src: /docs/yml/race.yml
-
name: remote_control
name_cased: remoteControl
name_pretty: 'Remote Control'
src: /docs/yml/remote_control.yml
-
name: rooftop_control
name_cased: rooftopControl
Expand Down
59 changes: 59 additions & 0 deletions docs/yml/cruise_control.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
title: 'Cruise Control'
content:
-
title: 'getState([, propertyNames])'
id: getState
children:
-
declaration: "```javascript\nhmkit.commands.CruiseControl.getState()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
returns: CruiseControlResponse
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.CruiseControl.getState(),\n accessCertificate\n);\n```"
-
id: CruiseControlResponse
title: CruiseControlResponse
parameters:
cruiseControl:
data.value: '(String) (enum) '
timestamp: (Date)
limiter:
data.value: '(String) (enum) '
timestamp: (Date)
targetSpeed:
data.value: '(Number) (speed) The target speed'
timestamp: (Date)
adaptiveCruiseControl:
data.value: '(String) (enum) '
timestamp: (Date)
accTargetSpeed:
data.value: '(Number) (speed) The target speed of the Adaptive Cruise Control'
timestamp: (Date)
example: "```json\n{\n \"cruiseControl\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": \"active\"\n }\n },\n \"limiter\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": \"higher_speed_requested\"\n }\n },\n \"targetSpeed\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": 61,\n \"unit\": \"kilometers_per_hour\"\n }\n },\n \"adaptiveCruiseControl\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": \"inactive\"\n }\n },\n \"accTargetSpeed\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": 67,\n \"unit\": \"kilometers_per_hour\"\n }\n }\n}\n```"
-
title: 'getAvailability([, propertyNames])'
id: get-availability
children:
-
declaration: "```javascript\nhmkit.commands.CruiseControl.getAvailability()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
example: "```javascript\n// Get availability for all properties\nhmkit.telematics.sendCommand(\n hmkit.commands.CruiseControl.getAvailability(),\n accessCertificate\n);\n// Get availability for specific properties\nhmkit.telematics.sendCommand(\n hmkit.commands.CruiseControl.getAvailability(['cruise_control']),\n accessCertificate\n);\n```"
-
id: availability-response
title: Response
parameters:
availability:
updateRate.value: '(String) enum'
rateLimit.value: (Number)
rateLimit.unit: (String)
appliesPer.value: (String)
discussion: 'The response contains an availability object for each property, as shown in the example'
example: "```json\n{\n \"cruise_control\": {\n \"availability\": {\n \"updateRate\": {\n \"value\": \"trip_high\"\n },\n \"rateLimit\": {\n \"value\": 64,\n \"unit\": \"hertz\"\n },\n \"appliesPer\": {\n \"value\": \"vehicle\"\n }\n }\n }\n}\n```"
-
id: activateDeactivateCruiseControl
title: 'activateDeactivateCruiseControl({ cruiseControl, targetSpeed })'
parameters:
cruiseControl: '(String) (enum) '
targetSpeed: '(Number) (speed) The target speed'
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.CruiseControl.activateDeactivateCruiseControl({\n \"cruiseControl\": \"active\",\n \"targetSpeed\": {\n \"kilometers_per_hour\": 61\n }\n }),\n accessCertificate\n);\n```"
40 changes: 40 additions & 0 deletions docs/yml/driver_fatigue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
title: 'Driver Fatigue'
content:
-
title: 'getState([, propertyNames])'
id: getState
children:
-
declaration: "```javascript\nhmkit.commands.DriverFatigue.getState()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
returns: DriverFatigueResponse
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.DriverFatigue.getState(),\n accessCertificate\n);\n```"
-
id: DriverFatigueResponse
title: DriverFatigueResponse
parameters:
detectedFatigueLevel:
data.value: '(String) (enum) '
timestamp: (Date)
example: "```json\n{\n \"detectedFatigueLevel\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": \"pause_recommended\"\n }\n }\n}\n```"
-
title: 'getAvailability([, propertyNames])'
id: get-availability
children:
-
declaration: "```javascript\nhmkit.commands.DriverFatigue.getAvailability()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
example: "```javascript\n// Get availability for all properties\nhmkit.telematics.sendCommand(\n hmkit.commands.DriverFatigue.getAvailability(),\n accessCertificate\n);\n// Get availability for specific properties\nhmkit.telematics.sendCommand(\n hmkit.commands.DriverFatigue.getAvailability(['detected_fatigue_level']),\n accessCertificate\n);\n```"
-
id: availability-response
title: Response
parameters:
availability:
updateRate.value: '(String) enum'
rateLimit.value: (Number)
rateLimit.unit: (String)
appliesPer.value: (String)
discussion: 'The response contains an availability object for each property, as shown in the example'
example: "```json\n{\n \"detected_fatigue_level\": {\n \"availability\": {\n \"updateRate\": {\n \"value\": \"trip_high\"\n },\n \"rateLimit\": {\n \"value\": 64,\n \"unit\": \"hertz\"\n },\n \"appliesPer\": {\n \"value\": \"vehicle\"\n }\n }\n }\n}\n```"
28 changes: 28 additions & 0 deletions docs/yml/heart_rate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
title: 'Heart Rate'
content:
-
title: 'getAvailability([, propertyNames])'
id: get-availability
children:
-
declaration: "```javascript\nhmkit.commands.HeartRate.getAvailability()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
example: "```javascript\n// Get availability for all properties\nhmkit.telematics.sendCommand(\n hmkit.commands.HeartRate.getAvailability(),\n accessCertificate\n);\n// Get availability for specific properties\nhmkit.telematics.sendCommand(\n hmkit.commands.HeartRate.getAvailability(['status']),\n accessCertificate\n);\n```"
-
id: availability-response
title: Response
parameters:
availability:
updateRate.value: '(String) enum'
rateLimit.value: (Number)
rateLimit.unit: (String)
appliesPer.value: (String)
discussion: 'The response contains an availability object for each property, as shown in the example'
example: "```json\n{\n \"status\": {\n \"availability\": {\n \"updateRate\": {\n \"value\": \"trip_high\"\n },\n \"rateLimit\": {\n \"value\": 64,\n \"unit\": \"hertz\"\n },\n \"appliesPer\": {\n \"value\": \"vehicle\"\n }\n }\n }\n}\n```"
-
id: sendHeartRate
title: 'sendHeartRate({ heartRate })'
parameters:
heartRate: '(Number) (frequency) '
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.HeartRate.sendHeartRate({\n \"heartRate\": {\n \"times_per_minute\": 64\n }\n }),\n accessCertificate\n);\n```"
40 changes: 40 additions & 0 deletions docs/yml/keyfob_position.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
title: 'Keyfob Position'
content:
-
title: 'getKeyfobPosition([, propertyNames])'
id: getKeyfobPosition
children:
-
declaration: "```javascript\nhmkit.commands.KeyfobPosition.getKeyfobPosition()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
returns: KeyfobPositionResponse
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.KeyfobPosition.getKeyfobPosition(),\n accessCertificate\n);\n```"
-
id: KeyfobPositionResponse
title: KeyfobPositionResponse
parameters:
location:
data.value: '(String) (enum) '
timestamp: (Date)
example: "```json\n{\n \"location\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": \"inside_car\"\n }\n }\n}\n```"
-
title: 'getAvailability([, propertyNames])'
id: get-availability
children:
-
declaration: "```javascript\nhmkit.commands.KeyfobPosition.getAvailability()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
example: "```javascript\n// Get availability for all properties\nhmkit.telematics.sendCommand(\n hmkit.commands.KeyfobPosition.getAvailability(),\n accessCertificate\n);\n// Get availability for specific properties\nhmkit.telematics.sendCommand(\n hmkit.commands.KeyfobPosition.getAvailability(['location']),\n accessCertificate\n);\n```"
-
id: availability-response
title: Response
parameters:
availability:
updateRate.value: '(String) enum'
rateLimit.value: (Number)
rateLimit.unit: (String)
appliesPer.value: (String)
discussion: 'The response contains an availability object for each property, as shown in the example'
example: "```json\n{\n \"location\": {\n \"availability\": {\n \"updateRate\": {\n \"value\": \"trip_high\"\n },\n \"rateLimit\": {\n \"value\": 64,\n \"unit\": \"hertz\"\n },\n \"appliesPer\": {\n \"value\": \"vehicle\"\n }\n }\n }\n}\n```"
60 changes: 60 additions & 0 deletions docs/yml/remote_control.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
title: 'Remote Control'
content:
-
title: 'getControlState([, propertyNames])'
id: getControlState
children:
-
declaration: "```javascript\nhmkit.commands.RemoteControl.getControlState()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
returns: RemoteControlResponse
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.RemoteControl.getControlState(),\n accessCertificate\n);\n```"
-
id: RemoteControlResponse
title: RemoteControlResponse
parameters:
controlMode:
data.value: '(String) (enum) '
timestamp: (Date)
angle:
data.value: '(Number) (angle) Wheel base angle'
timestamp: (Date)
example: "```json\n{\n \"controlMode\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": \"started\"\n }\n },\n \"angle\": {\n \"timestamp\": \"2021-06-01T15:48:04.887Z\",\n \"data\": {\n \"value\": 50,\n \"unit\": \"degrees\"\n }\n }\n}\n```"
-
title: 'getAvailability([, propertyNames])'
id: get-availability
children:
-
declaration: "```javascript\nhmkit.commands.RemoteControl.getAvailability()\n```"
parameters:
propertyNames: '(optional) Array of names of the properties you want returned.'
example: "```javascript\n// Get availability for all properties\nhmkit.telematics.sendCommand(\n hmkit.commands.RemoteControl.getAvailability(),\n accessCertificate\n);\n// Get availability for specific properties\nhmkit.telematics.sendCommand(\n hmkit.commands.RemoteControl.getAvailability(['control_mode']),\n accessCertificate\n);\n```"
-
id: availability-response
title: Response
parameters:
availability:
updateRate.value: '(String) enum'
rateLimit.value: (Number)
rateLimit.unit: (String)
appliesPer.value: (String)
discussion: 'The response contains an availability object for each property, as shown in the example'
example: "```json\n{\n \"control_mode\": {\n \"availability\": {\n \"updateRate\": {\n \"value\": \"trip_high\"\n },\n \"rateLimit\": {\n \"value\": 64,\n \"unit\": \"hertz\"\n },\n \"appliesPer\": {\n \"value\": \"vehicle\"\n }\n }\n }\n}\n```"
-
id: controlCommand
title: 'controlCommand({ angle, speed })'
parameters:
angle: '(Number) (angle) Wheel base angle'
speed: '(Number) (speed) Target speed'
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.RemoteControl.controlCommand({\n \"angle\": {\n \"degrees\": 50\n },\n \"speed\": {\n \"kilometers_per_hour\": 5\n }\n }),\n accessCertificate\n);\n```"
-
id: startControl
title: startControl()
parameters: {}
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.RemoteControl.startControl({}),\n accessCertificate\n);\n```"
-
id: stopControl
title: stopControl()
parameters: {}
example: "```javascript\nhmkit.telematics.sendCommand(\n hmkit.commands.RemoteControl.stopControl({}),\n accessCertificate\n);\n```"
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hmkit",
"version": "13.0.1",
"version": "13.0.2",
"description": "High Mobility SDK for Node.js",
"homepage": "https://github.com/highmobility/hmkit-node",
"bugs": "https://github.com/highmobility/hmkit-node/issues",
Expand Down
8 changes: 0 additions & 8 deletions src/Configuration/ResponseClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ import capabilitiesConfiguration from '../Configuration/capabilities.json';
import { capitalize } from '../Utils/Helpers';
import EmptyResponse from '../Responses/EmptyResponse';

const DISABLED_FOR_CATEGORIES = ['universal'];
const WEB_CONNECTION_TYPE = 'web';

const ResponseClasses = Object.values(capabilitiesConfiguration)
.filter(
capabilityConf =>
!(capabilityConf.disabled_in || []).includes(WEB_CONNECTION_TYPE) &&
!DISABLED_FOR_CATEGORIES.includes(capabilityConf.category)
)
.reduce((responseClasses, capabilityConf) => {
const capitalizedName = capitalize(capabilityConf.name_cased);
const { identifier } = capabilityConf;
Expand Down
5 changes: 0 additions & 5 deletions src/Utils/CommandUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export const CommandType = {
Setter: 'SET',
};

const WEB_CONNECTION_TYPE = 'web';
const commands = buildCommands();

function buildAvailabilityGetter(capabilityConf) {
Expand Down Expand Up @@ -528,10 +527,6 @@ function encodePropertyValue(value, encodingFunc) {

export function buildCommands() {
return Object.values(capabilitiesConfiguration)
.filter(
capabilityConf =>
!(capabilityConf.disabled_in || []).includes(WEB_CONNECTION_TYPE)
)
.reduce((allConf, capabilityConf) => {
const buildGettersAndSetters = !CAPABILITIES_WITH_NO_COMMANDS.includes(
capabilityConf.name
Expand Down
33 changes: 33 additions & 0 deletions test/capabilities/CruiseControl.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* The MIT License
*
* Copyright (c) 2014- High-Mobility GmbH (https://high-mobility.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* CruiseControl.spec.js
*
* Created by Mati Kärner on 19/07/2021.
*/

import getHmkit from '../testutils/getHmkit';
import { describeTest } from '../testutils/capabilityTests';

const hmkit = getHmkit();
describeTest('CruiseControl', hmkit.commands.CruiseControl);
Loading

0 comments on commit bf12799

Please sign in to comment.