...

Package mesh

import "github.com/Diarkis/diarkis/mesh/lib/packet"
Overview
Index

Overview ▾

Constants

MsgReliable Msg mode

const MsgReliable uint8 = 1

MsgUnreliable Msg mode

const MsgUnreliable uint8 = 2

TypeAck Message type

const TypeAck uint8 = 1

TypeErr Message type

const TypeErr uint8 = 5

TypeMsg Message type

const TypeMsg uint8 = 2

TypeReq Message type

const TypeReq uint8 = 3

TypeRes Message type

const TypeRes uint8 = 4

func CreatePayload

func CreatePayload(data map[string]interface{}) ([]byte, error)

CreatePayload Creates a payload byte array

func Pack

func Pack(msgMode uint8, msgType uint8, id string, reqID string, commandID uint16, payload []byte) ([]byte, error)

Pack Packs a payload to msg

func ParsePayload

func ParsePayload(payload []byte) (map[string]interface{}, error)

ParsePayload Parses payload

func Unpack

func Unpack(msg []byte) (uint8, uint8, string, string, uint16, []byte, error)

Unpack Unpacks a msg