https://github.com/tweichselbaumer/linkup
Label based communicaton library.
https://github.com/tweichselbaumer/linkup
arduino arduino-library communication cpp csharp dotnet nuget packets
Last synced: 3 months ago
JSON representation
Label based communicaton library.
- Host: GitHub
- URL: https://github.com/tweichselbaumer/linkup
- Owner: tweichselbaumer
- License: gpl-3.0
- Created: 2016-09-08T15:18:20.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-09-19T19:12:06.000Z (almost 3 years ago)
- Last Synced: 2025-10-18T21:03:40.692Z (9 months ago)
- Topics: arduino, arduino-library, communication, cpp, csharp, dotnet, nuget, packets
- Language: C#
- Homepage:
- Size: 602 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

## About
LinkUp is a cross platform lightweight communication library. The framework is able to transmit data between different microcontrollers, mobile devices and computers.
## Build
[](https://ci.appveyor.com/project/tweichselbaumer/linkup)
## Installation
The current version of the library is released on [nuget](https://www.nuget.org/packages/LinkUp).
### Arduino/C/C++
If you use Visual Studio for developing your Arduino/C/C++ Project, you can install the nessesary files by adding a nuget package with the nuget packages manager.
Alternatively, download the package from [nuget](https://www.nuget.org/packages/LinkUp), unzip the file and extract the files from *content\native*. Add these files to your project.
### C\#/.net/Xamarin/Portable
The C# version of the library can be installed by the nuget package manager.
If you create a portable library, make sure to use this LinkUp nuget package also at the nativ project to support the full functionality.
## Architecture
The LinkUp protocol is splitted into several layer. The LinkUpRaw layer which provides a communication protocol between two endpoints. The LinkUpLogic organizes nodes in a hirachical tree. Each node can provide there one labels. Labels represents different kinds of functionalties and are accessable from there node and all it's parent nodes.
### LinkUpRaw Layer
LinkUpRaw provides basic data transmissions between two endpoints. It encapsulats binary data into a header with preamble, length, data, CRC16 and EOP(end of packet). It has the capability to detect bit errors. The m Bytes with the value of preamble, EOP, skip pattern are replaced by the skip pattern and the actual value XOR 0x20.
#### LinkUpPacket
Name | Size (Byte) | Offset (Byte)
---- | ---- | ----
Preamble | 1 | 0
Length | 4 | 1
Data | n (max 2^32) | 5
CRC16 | 2 | n + 5
EOP | 1 |n + 7
## Get Started
### C\# - LinkUpRaw (single process)
In this sample the basic usage of LinkUpRaw will be demonstrated. In this case we use the LinkUpMemoryConnector which only provieds communication in the same programm. This code is mostly useful for testing purpose.
[Code](https://github.com/tweichselbaumer/LinkUp/tree/master/src/Testing/Example/Example1)
#### Initialisation
```cs
BlockingCollection col1 = new BlockingCollection();
BlockingCollection col2 = new BlockingCollection();
LinkUpMemoryConnector slaveToMaster = new LinkUpMemoryConnector(col1, col2);
LinkUpMemoryConnector masterToSlave = new LinkUpMemoryConnector(col2, col1);
```
#### Send Packet
```cs
slaveToMaster.SendPacket(new LinkUpPacket() { Data = data });
```
#### Receive Packet
```cs
masterToSlave.ReveivedPacket += MasterToSlave_ReveivedPacket;
```
### C\#/Arduino - LinkUpRaw (Serial Port)
The next example will show a basic communication between a C\# programm and an Arduino microcontroller.
[Code](https://github.com/tweichselbaumer/LinkUp/tree/master/src/Testing/Example/Example2)
#### Initialisation
##### C\# Program
```cs
LinkUpSerialPortConnector dataPort = new LinkUpSerialPortConnector(portName, baudRate);
```
##### Arduino
```cpp
LinkUpRaw connector;
```
#### Send Packet
##### C\# Program
```cs
dataPort.SendPacket(new LinkUpPacket() { Data = data });
```
##### Arduino
```cpp
LinkUpPacket packet;
connector.send(packet);
nBytesToSend = connector.getRaw(pBuffer, BUFFER_SIZE);
```
#### Receive Packet
##### C\# Program
```cs
dataPort.ReveivedPacket += DataPort_ReveivedPacket;
```
##### Arduino
```cpp
connector.progress(pBuffer, nBytesRead);
if (connector.hasNext())
{
LinkUpPacket packet = connector.next();
}
```
### C\#/C\# - LinkUpRaw (UDP)
The next example will show a basic communication between a C\# programm and an other C\# programm over UDP.
[Code](https://github.com/tweichselbaumer/LinkUp/tree/master/src/Testing/Example/Example4)
#### Initialisation
##### C\# Program
```cs
LinkUpUdpConnector connector = new LinkUpUdpConnector(sourceIp, destinationIp, sourcePort, destinationPort);
```
#### Send Packet
##### C\# Program
```cs
connector.SendPacket(new LinkUpPacket() { Data = data });
```
#### Receive Packet
##### C\# Program
```cs
connector.ReveivedPacket += DataPort_ReveivedPacket;
```