object

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 8 Imported by: 4

Documentation

Overview

file generated. DO NOT EDIT.

Index

Constants

View Source
const AuthenticateActionID = uint32(8)

AuthenticateActionID represents the action id of the authentication process.

View Source
const MetaObjectMethodID = 2

MetaObjectMethodID is the action id of the method MetaObject.

View Source
const MinUserActionID = 100

MinUserActionID is the first custom action id.

Variables

This section is empty.

Functions

func WriteMetaObject

func WriteMetaObject(s MetaObject, w io.Writer) (err error)

WriteMetaObject serialize a MetaObject.

func WriteObjectReference

func WriteObjectReference(s ObjectReference, w io.Writer) (err error)

WriteObjectReference unserialize an ObjectReference and returns it.

Types

type MetaMethod

type MetaMethod struct {
	Uid                 uint32
	ReturnSignature     string
	Name                string
	ParametersSignature string
	Description         string
	Parameters          []MetaMethodParameter
	ReturnDescription   string
}

MetaMethod is serializable

type MetaMethodParameter

type MetaMethodParameter struct {
	Name        string
	Description string
}

MetaMethodParameter is serializable

type MetaObject

type MetaObject struct {
	Methods     map[uint32]MetaMethod
	Signals     map[uint32]MetaSignal
	Properties  map[uint32]MetaProperty
	Description string
}

MetaObject is serializable

var MetaService0 MetaObject = MetaObject{
	Description: "Server",
	Methods: map[uint32]MetaMethod{
		AuthenticateActionID: {
			Uid:                 AuthenticateActionID,
			ReturnSignature:     "{sm}",
			Name:                "authenticate",
			ParametersSignature: "({sm})",
			Parameters: []MetaMethodParameter{
				{
					Name: "capability",
				},
			},
		},
	},
	Signals:    make(map[uint32]MetaSignal),
	Properties: make(map[uint32]MetaProperty),
}

MetaService0 represents the service id "0" used during authentication. It is a special service with only one method.

var ObjectMetaObject MetaObject = MetaObject{
	Description: "Object",
	Methods: map[uint32]MetaMethod{
		0x0: {
			Uid:                 0x0,
			ReturnSignature:     "L",
			Name:                "registerEvent",
			ParametersSignature: "(IIL)",
		},
		0x1: {
			Uid:                 0x1,
			ReturnSignature:     "v",
			Name:                "unregisterEvent",
			ParametersSignature: "(IIL)",
		},
		0x2: {
			Uid:                 0x2,
			ReturnSignature:     signature.MetaObjectSignature,
			Name:                "metaObject",
			ParametersSignature: "(I)",
		},
		0x3: {
			Uid:                 0x3,
			ReturnSignature:     "v",
			Name:                "terminate",
			ParametersSignature: "(I)",
		},
		0x5: {
			Uid:                 0x5,
			ReturnSignature:     "m",
			Name:                "property",
			ParametersSignature: "(m)",
		},
		0x6: {
			Uid:                 0x6,
			ReturnSignature:     "v",
			Name:                "setProperty",
			ParametersSignature: "(mm)",
		},
		0x7: {
			Uid:                 0x7,
			ReturnSignature:     "[s]",
			Name:                "properties",
			ParametersSignature: "()",
		},
		0x8: {
			Uid:                 0x8,
			ReturnSignature:     "L",
			Name:                "registerEventWithSignature",
			ParametersSignature: "(IILs)",
		},
		uint32(0x50): {
			Name:                "isStatsEnabled",
			ParametersSignature: "()",
			ReturnSignature:     "b",
			Uid:                 uint32(0x50),
		},
		uint32(0x51): {
			Name:                "enableStats",
			ParametersSignature: "(b)",
			ReturnSignature:     "v",
			Uid:                 uint32(0x51),
		},
		uint32(0x52): {
			Name:                "stats",
			ParametersSignature: "()",
			ReturnSignature:     "{I(I(fff)<MinMaxSum,minValue,maxValue,cumulatedValue>(fff)<MinMaxSum,minValue,maxValue,cumulatedValue>(fff)<MinMaxSum,minValue,maxValue,cumulatedValue>)<MethodStatistics,count,wall,user,system>}",
			Uid:                 uint32(0x52),
		},
		uint32(0x53): {
			Name:                "clearStats",
			ParametersSignature: "()",
			ReturnSignature:     "v",
			Uid:                 uint32(0x53),
		},
		uint32(0x54): {
			Name:                "isTraceEnabled",
			ParametersSignature: "()",
			ReturnSignature:     "b",
			Uid:                 uint32(0x54),
		},
		uint32(0x55): {
			Name:                "enableTrace",
			ParametersSignature: "(b)",
			ReturnSignature:     "v",
			Uid:                 uint32(0x55),
		},
	},
	Signals: map[uint32]MetaSignal{
		0x56: {
			Uid:       0x56,
			Name:      "traceObject",
			Signature: "((IiIm(ll)<timeval,tv_sec,tv_usec>llII)<EventTrace,id,kind,slotId,arguments,timestamp,userUsTime,systemUsTime,callerContext,calleeContext>)",
		},
	},
	Properties: make(map[uint32]MetaProperty),
}

ObjectMetaObject represents the generic actions all services (and objects) have (except service zero, see MetaService0).

func FullMetaObject

func FullMetaObject(from MetaObject) MetaObject

FullMetaObject fills the meta object with generic objects methods.

func ReadMetaObject

func ReadMetaObject(r io.Reader) (s MetaObject, err error)

ReadMetaObject unserialize a MetaObject and returns it.

func (*MetaObject) ActionName

func (m *MetaObject) ActionName(id uint32) (string, error)

ActionName returns the name of the method, signal or property.

func (*MetaObject) ForEachMethodAndSignal

func (m *MetaObject) ForEachMethodAndSignal(
	methodCall func(m MetaMethod, methodName string) error,
	signalCall func(s MetaSignal, signalName string) error,
	propertyCall func(p MetaProperty, propertyName string) error) error

ForEachMethodAndSignal call methodCall and signalCall for each method and signal respectively. Always call them in the same order and unsure the generated method names are unique within the object.

func (*MetaObject) JSON

func (m *MetaObject) JSON() string

JSON returns a json string describing the meta object.

func (*MetaObject) MethodID

func (m *MetaObject) MethodID(name, signature string) (uint32, string, error)

MethodID returns the ID of a method given its name, the parameters signature and the returned value signature.

func (*MetaObject) PropertyID

func (m *MetaObject) PropertyID(name, sig string) (uint32, error)

PropertyID returns the ID of a property given its name and its signature. If the signature does not match: - if it is not a tuple, try with a tuple - else return the first property with the same name

func (*MetaObject) PropertyName

func (m *MetaObject) PropertyName(id uint32) (string, error)

func (*MetaObject) SignalID

func (m *MetaObject) SignalID(name, sig string) (uint32, error)

SignalID returns the ID of a signal given its name and its signature. If the signature does not match: - if it is not a tuple, try with a tuple - else return the first signal with the same name

type MetaProperty

type MetaProperty struct {
	Uid       uint32
	Name      string
	Signature string
}

MetaProperty is serializable

type MetaSignal

type MetaSignal struct {
	Uid       uint32
	Name      string
	Signature string
}

MetaSignal is serializable

type Object

type Object interface {

	// MetaObject returns a description of an Object.
	MetaObject(objectID uint32) (MetaObject, error)

	// Terminate informs a service that an object is no longer needed.
	Terminate(objectID uint32) error

	// Subscribes to a signal or a property. Return an handler or
	// an error.
	RegisterEvent(objectID uint32, actionID uint32, handler uint64) (
		uint64, error)
	// Unsubscribe to a signal or a property.
	UnregisterEvent(objectID uint32, actionID uint32, handler uint64) error

	// RegisterEventWithSignature: is similar with RegisterEvent:
	// it subscribes to a signal. The value of the signal is
	// converted to the type described by the signature.
	// Not supported.
	RegisterEventWithSignature(objectID uint32, signalID uint32,
		handler uint64, signature string) (uint64, error)

	// Property returns the value of the property.
	Property(prop value.Value) (value.Value, error)

	// SetProperty update the value of a property.
	SetProperty(prop value.Value, val value.Value) error

	// Properties returns the list of properties.
	Properties() ([]string, error)
}

Object represents an object on QiMessaging. Every services implement the Object interface except the Server service which only has one method (authenticate).

type ObjectReference

type ObjectReference struct {
	MetaObject MetaObject
	ServiceID  uint32
	ObjectID   uint32
}

ObjectReference is serializable

func ReadObjectReference

func ReadObjectReference(r io.Reader) (s ObjectReference, err error)

ReadMetaObject serialize an ObjectReference.

Jump to

Keyboard shortcuts

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