Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Apr 8, 2024
1 parent e071251 commit a5dc7df
Show file tree
Hide file tree
Showing 15 changed files with 152 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"type": "cppdbg",
"request": "launch",
"program": "/home/akhe/development/VSCP/build/vscpd",
"args": ["-s","-c/home/akhe/development/VSCP/vscpl2drv-tcpiplink/debug/linux/vscpd.json"],
"args": ["-s","-c /home/akhe/development/VSCP/vscpl2drv-tcpiplink/debug/linux/vscpd.json"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
Expand Down
Binary file modified database
Binary file not shown.
6 changes: 3 additions & 3 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
* Introduction
* [Start](start.md)
* [Introduction](introduction.md)
* [Start](start.md)
* [Introduction](introduction.md)

* Setup
* [Setting up the system](setting_up_the_system.md)
* [Setting up the system](setting_up_the_system.md)

* Configure
* [The configuration file](configuring_the_vscp_daemon.md)
Expand Down
130 changes: 128 additions & 2 deletions docs/configuring_the_vscp_daemon.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The configuration file is used to tell which drivers should be used and how the VSCP daemon should operate. From version 15.0 this file has changed format from XML to JSON.

As always with configuration files it easy to make changes that make the system nonfunctional. Sp be careful when you edit the file and keep to the JSON standard. Most important keep a backup so that yo can go back to a working copy if something goes wrong.
As always with configuration files it easy to make changes that make the system nonfunctional. So be careful when you edit the file and keep to the JSON standard. Most important keep a backup so that yo can go back to a working copy if something goes wrong.

It is very convenient to use one of the online JSON validators to validate the JSON file when doing a lot of changes. There are many available and a good one is [this one](https://jsonformatter.curiousconcept.com/). Just copy the content of the file in the box and validate.

Expand All @@ -20,7 +20,80 @@ ps aux | grep vscpd

to see if the VSCP daemon is running or not.

The sample configuration file that is installed holds a lot of information. You can use degaults for most of it. A minimum configuration file looks like this

'''json
{
"runasuser": "vscp",
"debug": 0,
"guid": "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01",
"servername": "The VSCP daemon on HOST",
"classtypedb": "/var/lib/vscp/vscpd/vscp_events.sqlite3",
"maindb": "/var/lib/vscp/vscpd/vscp.sqlite3",
"discoverydb": "/var/lib/vscp/vscpd/vscp.sqlite3",
"vscpkey": "/etc/vscp/vscp.key",
"logging": {
"file-enable-log": true,
"file-log-level": "debug",
"file-pattern": "[vscp: %c] [%^%l%$] %v",
"file-path": "/var/log/vscp/vscpd.log",
"file-max-size": 5242880,
"file-max-files": 7,
"console-enable-log": true,
"console-log-level": "debug",
"console-pattern": "[vscp: %c] [%^%l%$] %v"
},
"mqtt": {
"bind": "",
"host": "test.mosquitto.org",
"port": 1883,
"mqtt-options": {
"tcp-nodelay": true,
"protocol-version": 311,
"receive-maximum": 20,
"send-maximum": 20,
"ssl-ctx-with-defaults": 0,
"tls-ocsp-required": 0,
"tls-use-os-certs": 0
},
"user": "",
"password": "",
"clientid": "",
"publish-format": "json",
"subscribe-format": "auto",
"qos": 1,
"bcleansession": false,
"bretain": false,
"keepalive": 60,
"bjsonmeasurementblock": true,
"topic-daemon-base": "vscp-daemon/status/{{guid}}/",
"topic-drivers": "drivers",
"topic-discovery": "discovery",
"will": {
"topic": "vscp-daemon/status/will/",
"qos": 1,
"retain": true,
"payload": "VSCP Daemon is down"
},
"subscribe": [
{
"topic": "vscp/mydaemon",
"qos": 0,
"v5-options": 0,
"format": "auto"
}
],
"publish": [
{
"topic": "vscp/{{guid}}",
"qos": 0,
"retain": false,
"format": "json"
}
]
}
}
'''

## Location of the configuration file

Expand Down Expand Up @@ -71,7 +144,7 @@ In the general section you find settings that are common to all components of th
"runasuser" : "vscp",
"debug" : 0,
"guid" : "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01",
"servername" : "The VSCP daemon",
"servername" : "The VSCP daemon on HOST",
"classtypedb" : "/var/lib/vscp/vscpd/vscp_events.sqlite3",
"maindb" : "/var/lib/vscp/vscpd/vscp.sqlite3",
"discoverydb" : "/var/lib/vscp/vscpd/vscp.sqlite3",
Expand All @@ -87,9 +160,60 @@ In the general section you find settings that are common to all components of th
"console-enable-log": false,
"console-log-level" : "info",
"console-pattern" : "[vscp %c] [%^%l%$] %v"
},
"mqtt": {
"host": "test.mosquitto.org",
"port": 1883,
"mqtt-options": {
"tcp-nodelay": true,
"protocol-version": 311,
"receive-maximum": 20,
"send-maximum": 20,
"ssl-ctx-with-defaults": 0,
"tls-ocsp-required": 0,
"tls-use-os-certs": 0
},
"user": "",
"password": "",
"clientid": "",
"publish-format": "json",
"subscribe-format": "auto",
"qos": 1,
"bcleansession": false,
"bretain": false,
"keepalive": 60,
"bjsonmeasurementblock": true,
"topic-daemon-base": "vscp-daemon/status/{{guid}}/",
"topic-drivers": "drivers",
"topic-discovery": "discovery",
"will": {
"topic": "vscp-daemon/status/{{srvguid}}/will",
"qos": 1,
"retain": true,
"payload": "VSCP Daemon is down"
},
"subscribe": [
{
"topic": "vscp/mydaemon",
"qos": 0,
"v5-options": 0,
"format": "auto"
}
],
"publish": [
{
"topic": "vscp/{{guid}}",
"qos": 0,
"retain": false,
"format": "json"
}
]
}
}
```

this will start up the daemon but do noting. You need to add a driver to get some work done.

### debug :id=config-gerneral-debug

The debug entry is a 64-bit number (each bit is a flag) that enable (if set) a specific debugging capability of the VSCP daemon. If you have problem you should enable the relevant bits to be able to detect the cause for the problem.
Expand Down Expand Up @@ -293,6 +417,8 @@ This is the password to use to login on the MQTT broker. Leave blank to use no c
### clientid :id=config-mqtt-clientid
Set the client id of this client. Note that **all client id's should be unique to a broker**. If not the client with the duplicate client id will be disconnected. If you leave this blank a random client id will be generated. The standard max length for client id's is 23 characters but most brokers accept longer client id's.

From version 15.0.3 you can use {{rnd}} in the client name to get a random 16 hex character string generated for the mustache tag.

### publish-format :id=config-mqtt-general-publish-format
This is the format the VSCP daemon will use to publish it's information if not set specially for the publish topic. There are four formats available

Expand Down
2 changes: 1 addition & 1 deletion docs/setting_up_the_system.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setting up the System

The VSCP Daemon is easy to setup. Just install the server and then configure the drivers you want to use. It is recommended to set up a local MQTT broker also but one can use one of the [public MQTT brokers](https://mntolia.com/10-free-public-private-mqtt-brokers-for-testing-prototyping/) for testing.
The VSCP Daemon is easy to setup. Just install the server and then configure the drivers you want to use. It is recommended to set up a local MQTT broker also but one can use one of the [public MQTT brokers](https://mntolia.com/10-free-public-private-mqtt-brokers-for-testing-prototyping/) for testing. Mosquitto is a very populöar choice that we recommend.

## Setting up the system on Linux

Expand Down
4 changes: 2 additions & 2 deletions docs/variables.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<var>
<creation-time>2021-09-22 15:13</creation-time>
<document-version>15.0.0-1 Phosphorus</document-version>
<creation-time>2024-04-07 18:31</creation-time>
<document-version>15.0.3-1 Phosphorus</document-version>
</var>
Binary file modified resources/database/vscp_events.sqlite3
Binary file not shown.
8 changes: 4 additions & 4 deletions resources/linux/vscpd.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"runasuser": "vscp",
"debug": 0,
"guid": "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01",
"servername": "The VSCP daemon",
"servername": "The VSCP daemon TEST at HOST",
"classtypedb": "/var/lib/vscp/vscpd/vscp_events.sqlite3",
"maindb": "/var/lib/vscp/vscpd/vscp.sqlite3",
"discoverydb": "/var/lib/vscp/vscpd/vscp.sqlite3",
Expand Down Expand Up @@ -41,7 +41,7 @@
"bretain": false,
"keepalive": 60,
"bjsonmeasurementblock": true,
"topic-daemon-base": "vscp-daemon/{{guid}}/",
"topic-daemon-base": "vscp-daemon/status/{{guid}}/",
"topic-drivers": "drivers",
"topic-discovery": "discovery",
"reconnect": {
Expand All @@ -63,10 +63,10 @@
"psk-identity": ""
},
"will": {
"topic": "vscp-daemon/{{srvguid}}/will",
"topic": "vscp-daemon/status/{{guid}}/will",
"qos": 1,
"retain": true,
"payload": "VSCP Daemon is down"
"payload": "VSCP Daemon HOST is down"
},
"subscribe": [
{
Expand Down
7 changes: 3 additions & 4 deletions resources/linux/vscpd.json.min-example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"runasuser": "vscp",
"debug": 0,
"guid": "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01",
"servername": "The VSCP daemon",
"servername": "The VSCP daemon on HOST",
"classtypedb": "/var/lib/vscp/vscpd/vscp_events.sqlite3",
"maindb": "/var/lib/vscp/vscpd/vscp.sqlite3",
"discoverydb": "/var/lib/vscp/vscpd/vscp.sqlite3",
Expand All @@ -19,7 +19,6 @@
"console-pattern": "[vscp: %c] [%^%l%$] %v"
},
"mqtt": {
"bind": "",
"host": "test.mosquitto.org",
"port": 1883,
"mqtt-options": {
Expand All @@ -41,11 +40,11 @@
"bretain": false,
"keepalive": 60,
"bjsonmeasurementblock": true,
"topic-daemon-base": "vscp-daemon/{{guid}}/",
"topic-daemon-base": "vscp-daemon/status/{{guid}}/",
"topic-drivers": "drivers",
"topic-discovery": "discovery",
"will": {
"topic": "vscp-daemon/{{srvguid}}/will",
"topic": "vscp-daemon/status/{{srvguid}}/will",
"qos": 1,
"retain": true,
"payload": "VSCP Daemon is down"
Expand Down
2 changes: 1 addition & 1 deletion src/vscp/common/vscp_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
This file is auto-generated
see https://github.com/grodansparadis/vscp-classes
Generated: 2023-04-19 20:30:52.856369
Generated: 2024-04-08 08:39:19.257091
*/

#ifndef VSCP_CLASS_H
Expand Down
2 changes: 1 addition & 1 deletion src/vscp/common/vscp_hashclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
This file is auto-generated
see https://github.com/grodansparadis/vscp-classes
Generated: 2023-04-19 20:30:53.791061
Generated: 2024-04-08 08:39:20.197532
*/

m_hashClass[ 0 ] = _("CLASS1_PROTOCOL");
Expand Down
2 changes: 1 addition & 1 deletion src/vscp/common/vscp_hashtype.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
This file is auto-generated
see https://github.com/grodansparadis/vscp-classes
Generated: 2023-04-19 20:30:54.255034
Generated: 2024-04-08 08:39:20.640516
*/


Expand Down
2 changes: 1 addition & 1 deletion src/vscp/common/vscp_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
!!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!!
This file is auto-generated
see https://github.com/grodansparadis/vscp-classes
Generated: 2023-04-19 20:30:53.290665
Generated: 2024-04-08 08:39:19.726474
*/

#ifndef VSCP_TYPE_H
Expand Down
2 changes: 1 addition & 1 deletion src/vscp/daemon/devicelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ CDeviceItem::stopDriver()
pthread_join(m_deviceThreadHandle, NULL);
pthread_mutex_unlock(&m_mutexdeviceThread);

spdlog::error("CDeviceItem: Driver stopping. {}\n", m_strName);
spdlog::info("CDeviceItem: Driver stopping. {}\n", m_strName);
}
else {
if (!m_bEnable) {
Expand Down
10 changes: 5 additions & 5 deletions src/vscp/daemon/devicethread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,15 @@ deviceThread(void *pData)
pDeviceItem->m_bQuit = true;

if (gDebugLevel & VSCP_DEBUG_DRIVERL1) {
spdlog::error("{}: [Device tread] Level I work loop ended.", pDeviceItem->m_strName);
spdlog::info("{}: [Device tread] Level I work loop ended.", pDeviceItem->m_strName);
}
}
else {

// * * * * Non blocking version * * * *

if (gDebugLevel & VSCP_DEBUG_DRIVERL1) {
spdlog::error("{}: [Device tread] Level I NON Blocking version.", pDeviceItem->m_strName);
spdlog::info("{}: [Device tread] Level I NON Blocking version.", pDeviceItem->m_strName);
}

while (!pDeviceItem->m_bQuit) {
Expand Down Expand Up @@ -595,14 +595,14 @@ deviceThread(void *pData)
} // if blocking/non blocking

if (gDebugLevel & VSCP_DEBUG_DRIVERL1) {
spdlog::debug("{}: [Device tread] Level I Work loop ended.", pDeviceItem->m_strName);
spdlog::info("{}: [Device tread] Level I Work loop ended.", pDeviceItem->m_strName);
}

// Close CANAL channel
pDeviceItem->m_proc_CanalClose(pDeviceItem->m_openHandle);

if (gDebugLevel & VSCP_DEBUG_DRIVERL1) {
spdlog::debug("{}: [Device tread] Level I Closed.", pDeviceItem->m_strName);
spdlog::info("{}: [Device tread] Level I Closed.", pDeviceItem->m_strName);
}

pDeviceItem->m_bQuit = true;
Expand Down Expand Up @@ -751,7 +751,7 @@ deviceThread(void *pData)
pDeviceItem->m_proc_VSCPClose(pDeviceItem->m_openHandle);

if (gDebugLevel & VSCP_DEBUG_DRIVERL2) {
spdlog::debug("{}: [Device tread] Level II Closed.", pDeviceItem->m_strName);
spdlog::info("{}: [Device tread] Level II Closed.", pDeviceItem->m_strName);
}

pDeviceItem->m_bQuit = true;
Expand Down

0 comments on commit a5dc7df

Please sign in to comment.