common

package
v0.0.0-...-0b0579e Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_UNKNOWN_ERROR         = -1
	STATUS_OK                    = 0
	STATUS_INVALID_REQUEST       = 1
	STATUS_INVALID_AUDIO         = 2
	STATUS_INFERENCE_FAILED      = 3
	STATUS_INVALID_VOICE_COMMAND = 4
)

Variables

This section is empty.

Functions

func ConnectIpfsPeers

func ConnectIpfsPeers(ctx context.Context, ipfs icore.CoreAPI, peers []string) error

func CreateIpfsNode

func CreateIpfsNode(ctx context.Context, repoPath string, swarmKey string, swarmAddresses []string) (icore.CoreAPI, error)

func GetOS

func GetOS() (string, string, error)

func LoadConfigFromFile

func LoadConfigFromFile(configPath string, config interface{}) error

func NewDevice

func NewDevice(sdk *blockchain.Sdk, name, description string) *bcommon.Device

func NewRequest

func NewRequest(requestId string, service bcommon.Service, method string, arguments []string) *bcommon.ServiceRequest

func NewResponse

func NewResponse(requestId string, statusCode int32, returnValue string) *bcommon.ServiceResponse

func NewService

func NewService(sdk *blockchain.Sdk, name, description string, version int32) *bcommon.Service

func RegisterOnBlockchain

func RegisterOnBlockchain(sdk *blockchain.Sdk, device *bcommon.Device, service *bcommon.Service) error

Types

type BlockchainClientConfig

type BlockchainClientConfig struct {
	OrganizationId string `yaml:"organization_id"`
	Certificate    string `yaml:"certificate"`
	PrivateKey     string `yaml:"private_key"`
}

type BlockchainDeviceConfig

type BlockchainDeviceConfig struct {
	DeviceName        string `yaml:"device_name"`
	DeviceDescription string `yaml:"device_description"`
}

type BlockchainGatewayConfig

type BlockchainGatewayConfig struct {
	Endpoint       string `yaml:"endpoint"`
	ServerName     string `yaml:"server_name"`
	TlsCertificate string `yaml:"tls_certificate"`
}

type BlockchainNetworkConfig

type BlockchainNetworkConfig struct {
	Name      string `yaml:"name"`
	Chaincode string `yaml:"chaincode"`
}

type BlockchainRequestManager

type BlockchainRequestManager struct {
	Sdk                 *blockchain.Sdk
	ListenService       *BlockchainServiceRef
	RequestHandler      func(*bcommon.ServiceRequest)
	ResponseHandler     func(*bcommon.ServiceResponse)
	OnGarbageCollection func(string)
	// contains filtered or unexported fields
}

func (*BlockchainRequestManager) Listen

func (mgr *BlockchainRequestManager) Listen(ctx context.Context) error

func (*BlockchainRequestManager) Request

func (mgr *BlockchainRequestManager) Request(requestId string, service bcommon.Service, method string, arguments []string) (*bcommon.ServiceRequest, error)

func (*BlockchainRequestManager) Respond

func (mgr *BlockchainRequestManager) Respond(requestId string, statusCode int32, returnValue string) (*bcommon.ServiceResponse, error)

type BlockchainServiceConfig

type BlockchainServiceConfig struct {
	ServiceName        string `yaml:"service_name"`
	ServiceVersion     int32  `yaml:"service_version"`
	ServiceDescription string `yaml:"service_description"`
}

type BlockchainServiceRef

type BlockchainServiceRef struct {
	OrganizationId string `yaml:"organization_id"`
	DeviceId       string `yaml:"device_id"`
	ServiceName    string `yaml:"service_name"`
}

type IpfsConfig

type IpfsConfig struct {
	RepoPath       string   `yaml:"repo_path"`
	SwarmKey       string   `yaml:"swarm_key"`
	SwarmAddresses []string `yaml:"swarm_addresses"`
	BootstrapPeers []string `yaml:"bootstrap_peers"`
}

type PicovoiceConfig

type PicovoiceConfig struct {
	AssetDir  string `yaml:"asset_dir"`
	AccessKey string `yaml:"access_key"`
}

Jump to

Keyboard shortcuts

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