metathings_device_cloud_service

package
v1.2.15 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrModuleNotFound                    = errors.New("module not found")
	ErrBadModuleEndpoint                 = errors.New("bad module endpoint")
	ErrUnsupportedModuleProxyDriver      = errors.New("unsupported module proxy driver")
	ErrUnsupportedFlowChannelDriver      = errors.New("unsupported flow channel driver")
	ErrUnsupportedDeviceConnectionDriver = errors.New("unsupported device connection driver")
	ErrUnmatchedRequestId                = errors.New("unmatched request id")
)
View Source
var (
	ErrUnexpectedContentType = errors.New("unexpected content type")
)
View Source
var (
	ErrUnsupportedPushFrameToFlowChannelDriver = errors.New("unsupported push frame to flow channel driver")
)

Functions

func GetSessionFromHeader

func GetSessionFromHeader(r *http.Request) int64

func GetTokenFromHeader

func GetTokenFromHeader(r *http.Request) string

func ParseHttpRequestBody

func ParseHttpRequestBody(r *http.Request, v proto.Message) error

func ParseHttpResponseBody

func ParseHttpResponseBody(v proto.Message) ([]byte, error)

Types

type DeviceConnection

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

func NewDeviceConnection

func NewDeviceConnection(args ...interface{}) (*DeviceConnection, error)

func (*DeviceConnection) Start

func (dc *DeviceConnection) Start() error

func (*DeviceConnection) Stop

func (dc *DeviceConnection) Stop() error

type DeviceConnectionOption

type DeviceConnectionOption struct {
	DeviceCloud struct {
		Session struct {
			Id string
		}
		Connection struct {
			MQTT struct {
				Address  string
				Username string
				Password string
			}
		}
	}
	Session struct {
		Startup    int32
		Major      int32
		Connection int64
	}
	Device struct {
		Id      string
		Modules []struct {
			Id string
		}
	}
	Config struct {
		HeartbeatInterval time.Duration
		HeartbeatTimeout  time.Duration

		Retry            int
		RetryInterval    time.Duration
		MaxRetryInterval time.Duration

		PingInterval time.Duration

		SendConfigResponseIntervalA   float64
		SendConfigResponseIntervalB   float64
		MaxSendConfigResponseInterval float64
		MaxSendConfigResponseRetry    int
	}
}

type MQTTPushFrameToFlowChannel

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

func (*MQTTPushFrameToFlowChannel) Channel

func (fc *MQTTPushFrameToFlowChannel) Channel() <-chan *pb.OpFrame

func (*MQTTPushFrameToFlowChannel) Close

func (fc *MQTTPushFrameToFlowChannel) Close() error

type MQTTPushFrameToFlowChannelFactory

type MQTTPushFrameToFlowChannelFactory struct{}

func (*MQTTPushFrameToFlowChannelFactory) New

func (f *MQTTPushFrameToFlowChannelFactory) New(args ...interface{}) (PushFrameToFlowChannel, error)

type MQTTPushFrameToFlowChannelOption

type MQTTPushFrameToFlowChannelOption struct {
	MQTT struct {
		Address           string
		Username          string
		Password          string
		ClientId          string
		QoS               byte
		DisconnectTimeout time.Duration
	}
	Device struct {
		Id string
	}
	Channel struct {
		Session string
		PushAck bool
	}
	Config struct {
		AliveInterval    time.Duration
		PingTimeout      time.Duration
		PushFrameTimeout time.Duration
	}
}

type MetathingsDeviceCloudService

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

func (*MetathingsDeviceCloudService) Heartbeat

func (*MetathingsDeviceCloudService) IssueModuleToken

func (s *MetathingsDeviceCloudService) IssueModuleToken(w http.ResponseWriter, r *http.Request)

func (*MetathingsDeviceCloudService) PushFrameToFlow

func (s *MetathingsDeviceCloudService) PushFrameToFlow(w http.ResponseWriter, r *http.Request)

func (*MetathingsDeviceCloudService) ShowModule

func (*MetathingsDeviceCloudService) ShowModuleFirmwareDescriptor added in v1.2.0

func (s *MetathingsDeviceCloudService) ShowModuleFirmwareDescriptor(w http.ResponseWriter, r *http.Request)

type MetathingsDeviceCloudServiceOption

type MetathingsDeviceCloudServiceOption struct {
	Session struct {
		Id string
	}
	Connection map[string]interface{}
	Credential struct {
		Id     string
		Secret string
	}
	Methods struct {
		PushFrameToFlow struct {
			PushAckTimeout     time.Duration
			PushAckFailedLimit int
		}
	}
}

type PushFrameToFlowChannel

type PushFrameToFlowChannel interface {
	Channel() <-chan *pb.OpFrame
	Close() error
}

func NewPushFrameToFlowChannel

func NewPushFrameToFlowChannel(name string, args ...interface{}) (PushFrameToFlowChannel, error)

type PushFrameToFlowChannelFactory

type PushFrameToFlowChannelFactory interface {
	New(args ...interface{}) (PushFrameToFlowChannel, error)
}

Jump to

Keyboard shortcuts

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