All Projects → lobaro → coap-go

lobaro / coap-go

Licence: MIT license
Lobaro CoAP for GoLang - server and client applications

Programming Languages

c
50402 projects - #5 most used programming language
go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to coap-go

transxchange2gtfs
tool to convert transxchange data into a GTFS feed
Stars: ✭ 26 (+30%)
Mutual labels:  transport
ioBroker.shelly
Shelly ioBroker Adapter
Stars: ✭ 108 (+440%)
Mutual labels:  coap
docker-lemp
A single container LEMP complete fullstack with latest release of PHP7.4.33, 8.0.26 & 8.1.13/8.2RC and MySQL, nginx, PostgreSQL, phalcon, swoole, mailcatcher, beanstalkd, elasticsearch, memcached, redis, adminer and all you ever need; on top alpine3.15
Stars: ✭ 106 (+430%)
Mutual labels:  stack
NALib
General purpose C sourcecode collection
Stars: ✭ 16 (-20%)
Mutual labels:  stack
BasicExercises
📘 Personal basic practice test playground.
Stars: ✭ 84 (+320%)
Mutual labels:  stack
BenEaterVHDL
VHDL project to run a simple 8-bit computer very similar to the one built by Ben Eater (see https://eater.net)
Stars: ✭ 30 (+50%)
Mutual labels:  uart
libcssl
Columbo Simple Serial Library is an easy to use, event driven serial port communication library for Linux.
Stars: ✭ 38 (+90%)
Mutual labels:  uart
vbb-hafas
A JavaScript client for Berlin & Brandenburg public transport HAFAS API.
Stars: ✭ 28 (+40%)
Mutual labels:  transport
Quad-Serial
Quad serial project with FTDI CI's, Isolation and 1.8~5.5v UART port.
Stars: ✭ 17 (-15%)
Mutual labels:  uart
ble-serial
"RFCOMM for BLE" a UART over Bluetooth low energy (4.0+) bridge for Linux, Mac and Windows
Stars: ✭ 134 (+570%)
Mutual labels:  uart
uPy-rosserial
An implementation of rosserial for uPy.
Stars: ✭ 19 (-5%)
Mutual labels:  uart
charm
A [ functional stack ] based language.
Stars: ✭ 26 (+30%)
Mutual labels:  stack
CoAPExplorer
A (soon to be) cross-platform tool for exploring CoAP protocol.
Stars: ✭ 16 (-20%)
Mutual labels:  coap
db-hafas
JavaScript client for the Deutsche Bahn HAFAS API.
Stars: ✭ 54 (+170%)
Mutual labels:  transport
Firmware Over The Air
graduation project of ITI, flashing a new firmware over the air for automotive industry
Stars: ✭ 18 (-10%)
Mutual labels:  uart
apollo-client-ws
GraphQL WebSocket Network Interface for Apollo Client
Stars: ✭ 13 (-35%)
Mutual labels:  transport
db-stations
A list of DB stations.
Stars: ✭ 15 (-25%)
Mutual labels:  transport
needle
📌📚 An extensive standalone data structure library for JavaScript.
Stars: ✭ 25 (+25%)
Mutual labels:  stack
DTA
This repository documents MATLAB implementation of a dynamic user equilibrium solver, including a dynamic network loading sub-routine
Stars: ✭ 55 (+175%)
Mutual labels:  transport
bvg-topological-map
BVG transport map as a nice SVG.
Stars: ✭ 15 (-25%)
Mutual labels:  transport

Lobaro CoAP for GoLang

This repository contains two parts: The CoAP Client and a GoLang Server adapter. The client focuses on RS232 connections where data is send via Slip and SlipMUX

Currently not Maintained

Since we moved to existing more major CoAP implementations, this repo will stay unmaintained.

We recommend:

GoLang CoAP RS232 Client

Currently only RS232 is supported. Transports for other Protocols like TCP/IP and UDP are planned.

Install:

go get -u github.com/lobaro/coap-go/coap

The package is strctured similiar to the http package and tries to follow go idematic coding styles.

GoLang Server adapter for lobaro-coap

A word of warning: While the C code works fine and is already used in several projects, the Go wrapper is still under construction. We might even considder to reimplement the server in Go rather than wrapping the C code.

Lobaro CoAP provides a highly portable CoAP stack for Client and Server running on almost any hardware.

The GoLang adapter uses cgo to provide a CoAP stack based on the code of Lobaro CoAP. It can be used for testing the stack on a PC and to write server applications in go that can handle CoAP connections.

Getting Started

The project consists of multiple submodules:

  • coap - A pure Go client library with an API similar to Go's http package. Supports multiple Transports (e.g. RS232).
  • liblobarocoap - A CGO wrapper around Lobaro CoAP C Implementation.
  • coapmsg The underlying CoAP message structure used by other packages. Based on dustin/go-coap.

It is planned to extend the coap package to support more transports like UDP, TCP in future. The package will also get some code to setup CoAP servers. First based on liblobarocoap and later also in native Go.

Contributions are welcome!

Prerequisite

To build the project you need a C compiler and the matching Go toolkit installed.

For Windows you can use MinGW to install the gcc.

When you have a 32 bit C compiler make sure you also use 32 bit Go. Else cgo will not be able to compile the C code.

Install the code

go get -u github.com/lobaro/coap-go

Execute tests

go test github.com/lobaro/coap-go

To use the library in your project, just import

import "github.com/lobaro/coap-go"

Usage

Observe

// Start observing, res is the result of a GET request
res, err := coap.Observe(url)
if err != nil {
	panic(err)
}
// Gracefully cancel the observe at the end of this function
defer coap.CancelObserve(res)
var timeoutCh time.After(60 * time.Second)

for {
	select {
	// res.Next returns a response with a new Next channel
	// as soon as the client receives a notification from the server
	case nextRes, ok := <-res.Next:
		if !ok {
			return
		}
		res = nextRes // update res for next interation
		// Handle the Notification (res)
	case <-time.After(20 * time.Second):
		return // Cancel observe after 20 seconds of silence
	case <-timeoutCh:
		return // Cancel observe after 60 seconds
	}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].