glassdome_go

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2019 License: MIT Imports: 5 Imported by: 0

README

Glassdome Go SDK

This SDK is designed to be used as part of the Docker application that developers write to deploy to Glassdome gateways.

By using this SDK, developers gain the following benefits:

  • Easy interaction with different kinds of local area networks with gateways
  • Centralized logging for network communications (e.g. connection, disconnection) and visibility of these activities in Glassdome cloud console
  • Unified interface across different networks (i.e. "write once and support different connectivity scenarios")

Installation

go get github.com/glassdomeinc/glassdome-go

Example

This is a simple example of how to use this Glassdome Go SDK.

package main

import (
	"fmt"
	// Import Glassdome client SDK
	Glassdome "github.com/glassdomeinc/glassdome-go"
)

func main() {

	Glassdome.InitClient()

	Glassdome.SetConnectionHandler(func() {
		fmt.Println("Detected BLE device connection!")
	})

	Glassdome.SetDisconnectionHandler(func() {
		fmt.Println("Detected BLE device disconnection!")
	})

	Glassdome.SetNotificationHandler(func(payload []byte) {
		fmt.Printf("Received notification payload: %s\n", payload)
	})

	// Loop forever to not exit the program
	select {}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitClient

func InitClient()

func SetConnectionHandler

func SetConnectionHandler(handler ConnectionHandler)

func SetDisconnectionHandler

func SetDisconnectionHandler(handler DisconnectionHandler)

func SetNotificationHandler

func SetNotificationHandler(handler NotificationHandler)

Types

type ConnectedMessage

type ConnectedMessage struct {
	// contains filtered or unexported fields
}

type ConnectionHandler

type ConnectionHandler func()

type DisconnectionHandler

type DisconnectionHandler func()

type MessageHandler

type MessageHandler func(payload []byte)

type NotificationHandler

type NotificationHandler func(payload []byte)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL