Skip to content

Commit

Permalink
Updated manual with MQTT connection info
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed Feb 10, 2025
1 parent 281ec65 commit 8f4982a
Show file tree
Hide file tree
Showing 19 changed files with 119 additions and 95 deletions.
8 changes: 8 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@

* **Connections**
* [General](connections.md)
* [CANAL](connection_canal.md)
* [Socketcan](connection_socketcan.md)
* [tcp/ip](connection_tcpip.md)
* [MQTT](connection_mqtt.md)
* [WS1](connection_ws1.md)
* [WS2](connection_ws2.md)
* [UDP](connection_udp.md)
* [Multicast](connection_multicast.md)

* **Session window**
* [General](session_window.md)
Expand Down
43 changes: 43 additions & 0 deletions docs/connection_canal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Add Connection

![](./images/add_connection_canal.png)

- `Description`: Set a descriptive name. This value will be used to identify the connection in the treeview.
- `Path to driver`: Set the path to the CANAL driver to use. Click `set` to browse for the file. CANAL drivers are the same as `VSCP level I drivers`and on most Linux systems you can find them by default in the _/var/lib/vscp/drivers/level1/_ folder. Windows system usually have them in the folder _appdir/VSCP/drivers/level1. The exact location depends on the installation for the driver.
- `Device configuration string`: CANAL drivers are configured using a semicolon separated string. This string is deriver dependent. The exact format is described in the driver documentation. Some modern drivers have a wizard that can help you to construct this configuration string. Press `wizard` button to open this dialog.
- `Device flags`: This is a bit mask that can be used to set some flags for the driver. The exact meaning of the bits is driver dependent. The driver documentation will tell you what the bits mean.
- `Datarate`: This is a device specific value for the communication rate. It is usually in bits per second but the exact meaning is driver dependent. The driver documentation will tell you what the value should be. In most cases you can leave this value to the default value zero.

## Filter

The filter for a CANAL driver is two 32-bit values that are used to filter out messages that are not of interest. The first value is the mask and the second value is the filter. If the mask is zero all messages are passed. If the mask is not zero only messages that match the filter are passed. The filter is a bitwise AND operation between the mask and the message id. If the result is equal to the filter the message is passed.

Truth table for filter/mask

| Mask bit n | Filter bit n | Incoming event class/type bit n | Accept or reject bit n |
|:------------:|:--------------:|:---------------------------:|:------------------------:|
| 0 | x | x | Accept |
| 1 | 0 | 0 | Accept |
| 1 | 0 | 1 | Reject |
| 1 | 1 | 0 | Reject |
| 1 | 1 | 1 | Accept |

Think of the mask as having ones at positions that are of interest and the filter telling what the value should be for those bit positions that are of interest.

- So to only accept one class set all mask bits to one and enter the class in filter.
- To accept all classes set the mask to 0. In this case filter don't care.

![](canal_filter_wizard.png)

The `Filter wizard` makes it easy to construct filters for your specific need. Just press the `wizard` button and the dialog will open. Enter the class and type you want to filter on and the wizard will construct the filter and mask for you.


![](id_mask.png)

Press the ID/Mask` button to open the dialog where you can enter the filter and mask manually as a 32-bit value.

![](filter_wizard)

The `wizard button` can give you a view of what events are filtered out an not. Select what you are interested in the right part and transfer as filter value using `<<` button or vice versa using the `>>` button.

In all above cases the numerical base dialog can be used to set the display numerical base for all values. The default is hexadecimal but you can also use decimal, octal or binary. Numbers can be entered using any base. Just proceed hexadecimals with `0x`, octals with `0o` and binary with `0b`. No prefix will be read as decimal values.
4 changes: 4 additions & 0 deletions docs/connection_mqtt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add Connection

![](./images/add_connection_mqtt.png)

3 changes: 3 additions & 0 deletions docs/connection_multicast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Add Connection

![](./images/add_connection_multicast.png)
23 changes: 23 additions & 0 deletions docs/connection_socketcan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Add a connection

Select the connection type you want to add in the treeview and right click. Select `Add connection` in the context menu. A dialog will open where you can enter the parameters for the connection.

![](./images/add_connection_socketcan.png)

- `Description`: Set a descriptive name. This value will be used to identify the connection in the treeview.
- `Device`: Set the device name for the CAN interface. This is usually something like `can0` or `can1`. The exact name is system dependent. You can find the names in the `/sys/class/net/` folder.
- `Flags`: Socketcan flags. The flags are used to set some special options for the CAN interface. Press the `...` button to open a dialog where you can set the flags.
- `Response timeout`: The time in milliseconds to wait for a response from the device. If no response is received the operation will be aborted.
- `Filters`: You can set any number of filters for the CAN interface. The filter is a 32-bit value that is used to filter out messages that are not of interest. If the mask is zero all messages are passed. If the mask is not zero only messages that match the filter are passed. The filter is a bitwise AND operation between the mask and the message id. If the result is equal to the filter the message is passed.

## Test button
Press the `Test connection` button to check if your socketcan settings works.

## Filters
You can use the `Add filter` button to add a filter, `Edit filter` button to edit a selected a filter, `Clone filter` button to clone a selected filter and `Delete filter` button to remove a selected filter.

- Click on a filter item to select it.
- Double click on a filter item to edit it.
- Right click on a filter item to get a context menu where you can edit, clone or delete the filter.

See [CANAL filters](connections.md) for more information about filters.
16 changes: 16 additions & 0 deletions docs/connection_tcpip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Add Connection

![](./images/add_connection_tcpip.png)

## SSL/TLS

![](./images/add_connection_tcpip_tls.png)

## Filters
![](./images/add_connection_tcpip_filter.png)

## Test connection
![](./images/add_connection_tcpip_test.png)

## Get Interfaces
![](./images/add_connection_tcpip_interfaces.png)
3 changes: 3 additions & 0 deletions docs/connection_udp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Add Connection
![](./images/add_connection_udp.png)

3 changes: 3 additions & 0 deletions docs/connection_ws1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Add Connection
![](./images/add_connection_ws1.png)

3 changes: 3 additions & 0 deletions docs/connection_ws2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Add Connection
![](./images/add_connection_ws2.png)

108 changes: 13 additions & 95 deletions docs/connections.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Introduction

In the mainwindow of VSCP Works you have a treeview with all communication channels that are available. This is the place where you add, remove and configure connections to your remote hardware devices. Normally you right click on the treeview and select the operation you want to perform. You can also use the file meny items or the toolbar for the same task. It is perfectly fine for most cases to have several windows open at the same time to a selected communication item.
In the mainwindow of VSCP Works you have a treeview with all communication channels that are available. This is the place where you add, remove and configure connections to your remote hardware devices. Normally you right click on the treeview and select the operation you want to perform. You can also use the file menu items or the toolbar for the same task. It is perfectly fine for most cases to have several windows open at the same time to a selected communication item.



# Communication types/protocols

![](./images/connections.png)

VSCP Works can communicate with a diverse number of different hardware devices using many different communication protocols. The following protocols are currently supported:

* [CANAL](./connections?id=canal)
* [Socketcan](./connections?id=socketcan)
* [tcp/ip](./connections?id=tcp/ip)
* [MQTT](./connections?id=mqtt)
* [WS1](./connections?id=ws1)
* [WS2](./connections?id=ws2)
* [UDP](./connections?id=udp)
* [Multicast](./connections?id=multicast)

| Protocol | Description |
|----------|-------------|
| [**CANAL**](https://grodansparadis.github.io/vscp-doc-canal/#/) | The VSCP **CAN** **A**bstraction **L**ayer. This is a VSCP level I communication that is based on a CAN frame. A `CANAL driver`is the same as a `VSCP Level I driver` and this driver is responsible for abstraction from the VSCP world of events to low end frames or simulations. The frame format and other details is described [here](https://grodansparadis.github.io/vscp-doc-spec/#/./vscp_over_can_can4vscp) |
Expand All @@ -19,106 +30,13 @@ VSCP Works can communicate with a diverse number of different hardware devices u
| [UDP](https://grodansparadis.github.io/vscp-doc-spec/#/./vscp_over_udp) | VSCP connection less UDP communication protocol. |
| [Multicast](https://grodansparadis.github.io/vscp-doc-spec/#/./vscp_over_multicast?id=vscp-multicast) | VSCP multicast. |

# Add a connection

Select the connection type you want to add in the treeview and right click. Select `Add connection` in the context menu. A dialog will open where you can enter the parameters for the connection.

## CANAL

![](./images/add_connection_canal.png)

- `Description`: Set a descriptive name. This value will be used to identify the connection in the treeview.
- `Path to driver`: Set the path to the CANAL driver to use. Click `set` to browse for the file. CANAL drivers are the same as `VSCP level I drivers`and on most Linux systems you can find them by default in the _/var/lib/vscp/drivers/level1/_ folder. Windows system usually have them in the folder _appdir/VSCP/drivers/level1. The exact location depends on the installation for the driver.
- `Device configuration string`: CANAL drivers are configured using a semicolon separated string. This string is deriver dependent. The exact format is described in the driver documentation. Some modern drivers have a wizard that can help you to construct this configuration string. Press `wizard` button to open this dialog.
- `Device flags`: This is a bit mask that can be used to set some flags for the driver. The exact meaning of the bits is driver dependent. The driver documentation will tell you what the bits mean.
- `Datarate`: This is a device specific value for the communication rate. It is usually in bits per second but the exact meaning is driver dependent. The driver documentation will tell you what the value should be. In most cases you can leave this value to the default value zero.

### Filter

The filter for a CANAL driver is two 32-bit values that are used to filter out messages that are not of interest. The first value is the mask and the second value is the filter. If the mask is zero all messages are passed. If the mask is not zero only messages that match the filter are passed. The filter is a bitwise AND operation between the mask and the message id. If the result is equal to the filter the message is passed.

Truth table for filter/mask

| Mask bit n | Filter bit n | Incoming event class/type bit n | Accept or reject bit n |
|:------------:|:--------------:|:---------------------------:|:------------------------:|
| 0 | x | x | Accept |
| 1 | 0 | 0 | Accept |
| 1 | 0 | 1 | Reject |
| 1 | 1 | 0 | Reject |
| 1 | 1 | 1 | Accept |

Think of the mask as having ones at positions that are of interest and the filter telling what the value should be for those bit positions that are of interest.

- So to only accept one class set all mask bits to one and enter the class in filter.
- To accept all classes set the mask to 0. In this case filter don't care.

![](canal_filter_wizard.png)

The `Filter wizard` makes it easy to construct filters for your specific need. Just press the `wizard` button and the dialog will open. Enter the class and type you want to filter on and the wizard will construct the filter and mask for you.


![](id_mask.png)

Press the ID/Mask` button to open the dialog where you can enter the filter and mask manually as a 32-bit value.

![](filter_wizard)

The `wizard button` can give you a view of what events are filtered out an not. Select what you are interested in the right part and transfer as filter value using `<<` button or vice versa using the `>>` button.

In all above cases the numerical base dialog can be used to set the display numerical base for all values. The default is hexadecimal but you can also use decimal, octal or binary. Numbers can be entered using any base. Just proceed hexadecimals with `0x`, octals with `0o` and binary with `0b`. No prefix will be read as decimal values.

## Socketcan
![](./images/add_connection_socketcan.png)

- `Description`: Set a descriptive name. This value will be used to identify the connection in the treeview.
- `Device`: Set the device name for the CAN interface. This is usually something like `can0` or `can1`. The exact name is system dependent. You can find the names in the `/sys/class/net/` folder.
- `Flags`: Socketcan flags. The flags are used to set some special options for the CAN interface. Press the `...` button to open a dialog where you can set the flags.
- `Response timeout`: The time in milliseconds to wait for a response from the device. If no response is received the operation will be aborted.
- `Filters`: You can set any number of filters for the CAN interface. The filter is a 32-bit value that is used to filter out messages that are not of interest. If the mask is zero all messages are passed. If the mask is not zero only messages that match the filter are passed. The filter is a bitwise AND operation between the mask and the message id. If the result is equal to the filter the message is passed.

### Test button
Press the `Test connection` button to check if your socketcan settings works.

### Filters
You can use the `Add filter` button to add a filter, `Edit filter` button to edit a selected a filter, `Clone filter` button to clone a selected filter and `Delete filter` button to remove a selected filter.

- Click on a filter item to select it.
- Double click on a filter item to edit it.
- Right click on a filter item to get a context menu where you can edit, clone or delete the filter.

See [CANAL filters](connections.md) for more information about filters.

## tcp/ip

![](./images/add_connection_tcpip.png)

### SSL/TLS

![](./images/add_connection_tcpip_tls.png)

### Filters
![](./images/add_connection_tcpip_filter.png)

### Test connection
![](./images/add_connection_tcpip_test.png)
Click on the protocol name to get more information about the protocol.

### Get Interfaces
![](./images/add_connection_tcpip_interfaces.png)

## MQTT
![](./images/add_connection_mqtt.png)

## WS1
![](./images/add_connection_ws1.png)

## WS2
![](./images/add_connection_ws2.png)

## UDP
![](./images/add_connection_udp.png)

## Multicast
![](./images/add_connection_multicast.png)

# Remove a connection

Expand Down
Binary file added docs/images/add_connection_mqtt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/add_connection_mqtt_add_publish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/add_connection_mqtt_tls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/socketcan_test_vcan0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/socketcan_test_vcan0_response.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/socketcan_test_vcan0_send_turnon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/socketcan_test_vcan0_tx_turnon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8f4982a

Please sign in to comment.