contexthub

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionIContextHubGetContextHubs                 = binder.FirstCallTransaction + 0
	TransactionIContextHubLoadNanoapp                    = binder.FirstCallTransaction + 1
	TransactionIContextHubUnloadNanoapp                  = binder.FirstCallTransaction + 2
	TransactionIContextHubDisableNanoapp                 = binder.FirstCallTransaction + 3
	TransactionIContextHubEnableNanoapp                  = binder.FirstCallTransaction + 4
	TransactionIContextHubOnSettingChanged               = binder.FirstCallTransaction + 5
	TransactionIContextHubQueryNanoapps                  = binder.FirstCallTransaction + 6
	TransactionIContextHubRegisterCallback               = binder.FirstCallTransaction + 7
	TransactionIContextHubSendMessageToHub               = binder.FirstCallTransaction + 8
	TransactionIContextHubOnHostEndpointConnected        = binder.FirstCallTransaction + 9
	TransactionIContextHubOnHostEndpointDisconnected     = binder.FirstCallTransaction + 10
	TransactionIContextHubGetPreloadedNanoappIds         = binder.FirstCallTransaction + 11
	TransactionIContextHubOnNanSessionStateChanged       = binder.FirstCallTransaction + 12
	TransactionIContextHubSetTestMode                    = binder.FirstCallTransaction + 13
	TransactionIContextHubSendMessageDeliveryStatusToHub = binder.FirstCallTransaction + 14
)
View Source
const (
	MethodIContextHubGetContextHubs                 = "getContextHubs"
	MethodIContextHubLoadNanoapp                    = "loadNanoapp"
	MethodIContextHubUnloadNanoapp                  = "unloadNanoapp"
	MethodIContextHubDisableNanoapp                 = "disableNanoapp"
	MethodIContextHubEnableNanoapp                  = "enableNanoapp"
	MethodIContextHubOnSettingChanged               = "onSettingChanged"
	MethodIContextHubQueryNanoapps                  = "queryNanoapps"
	MethodIContextHubRegisterCallback               = "registerCallback"
	MethodIContextHubSendMessageToHub               = "sendMessageToHub"
	MethodIContextHubOnHostEndpointConnected        = "onHostEndpointConnected"
	MethodIContextHubOnHostEndpointDisconnected     = "onHostEndpointDisconnected"
	MethodIContextHubGetPreloadedNanoappIds         = "getPreloadedNanoappIds"
	MethodIContextHubOnNanSessionStateChanged       = "onNanSessionStateChanged"
	MethodIContextHubSetTestMode                    = "setTestMode"
	MethodIContextHubSendMessageDeliveryStatusToHub = "sendMessageDeliveryStatusToHub"
)
View Source
const (
	TransactionIContextHubCallbackHandleNanoappInfo           = binder.FirstCallTransaction + 0
	TransactionIContextHubCallbackHandleContextHubMessage     = binder.FirstCallTransaction + 1
	TransactionIContextHubCallbackHandleContextHubAsyncEvent  = binder.FirstCallTransaction + 2
	TransactionIContextHubCallbackHandleTransactionResult     = binder.FirstCallTransaction + 3
	TransactionIContextHubCallbackHandleNanSessionRequest     = binder.FirstCallTransaction + 4
	TransactionIContextHubCallbackHandleMessageDeliveryStatus = binder.FirstCallTransaction + 5
	TransactionIContextHubCallbackGetUuid                     = binder.FirstCallTransaction + 6
	TransactionIContextHubCallbackGetName                     = binder.FirstCallTransaction + 7
)
View Source
const (
	MethodIContextHubCallbackHandleNanoappInfo           = "handleNanoappInfo"
	MethodIContextHubCallbackHandleContextHubMessage     = "handleContextHubMessage"
	MethodIContextHubCallbackHandleContextHubAsyncEvent  = "handleContextHubAsyncEvent"
	MethodIContextHubCallbackHandleTransactionResult     = "handleTransactionResult"
	MethodIContextHubCallbackHandleNanSessionRequest     = "handleNanSessionRequest"
	MethodIContextHubCallbackHandleMessageDeliveryStatus = "handleMessageDeliveryStatus"
	MethodIContextHubCallbackGetUuid                     = "getUuid"
	MethodIContextHubCallbackGetName                     = "getName"
)
View Source
const (
	NanoappBinaryFlagSigned     int32 = (1 << 0)
	NanoappBinaryFlagEncrypted  int32 = (1 << 1)
	NanoappBinaryFlagTcmCapable int32 = (1 << 2)
)
View Source
const DescriptorIContextHub = "android.hardware.contexthub.IContextHub"
View Source
const DescriptorIContextHubCallback = "android.hardware.contexthub.IContextHubCallback"
View Source
const (
	IContextHubCallbackContexthubNanTransactionTimeoutMs int32 = 10000
)
View Source
const (
	IContextHubExContextHubUnspecified int32 = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncEventType

type AsyncEventType int32
const (
	AsyncEventTypeRESTARTED AsyncEventType = 1
)

type ContextHubCallbackProxy

type ContextHubCallbackProxy struct {
	Remote binder.IBinder
}

func NewContextHubCallbackProxy

func NewContextHubCallbackProxy(
	remote binder.IBinder,
) *ContextHubCallbackProxy

func (*ContextHubCallbackProxy) AsBinder

func (p *ContextHubCallbackProxy) AsBinder() binder.IBinder

func (*ContextHubCallbackProxy) GetName

func (p *ContextHubCallbackProxy) GetName(
	ctx context.Context,
) (string, error)

func (*ContextHubCallbackProxy) GetUuid

func (p *ContextHubCallbackProxy) GetUuid(
	ctx context.Context,
) ([]byte, error)

func (*ContextHubCallbackProxy) HandleContextHubAsyncEvent

func (p *ContextHubCallbackProxy) HandleContextHubAsyncEvent(
	ctx context.Context,
	evt AsyncEventType,
) error

func (*ContextHubCallbackProxy) HandleContextHubMessage

func (p *ContextHubCallbackProxy) HandleContextHubMessage(
	ctx context.Context,
	msg ContextHubMessage,
	msgContentPerms []string,
) error

func (*ContextHubCallbackProxy) HandleMessageDeliveryStatus

func (p *ContextHubCallbackProxy) HandleMessageDeliveryStatus(
	ctx context.Context,
	hostEndpointId uint16,
	messageDeliveryStatus MessageDeliveryStatus,
) error

func (*ContextHubCallbackProxy) HandleNanSessionRequest

func (p *ContextHubCallbackProxy) HandleNanSessionRequest(
	ctx context.Context,
	request NanSessionRequest,
) error

func (*ContextHubCallbackProxy) HandleNanoappInfo

func (p *ContextHubCallbackProxy) HandleNanoappInfo(
	ctx context.Context,
	appInfo []NanoappInfo,
) error

func (*ContextHubCallbackProxy) HandleTransactionResult

func (p *ContextHubCallbackProxy) HandleTransactionResult(
	ctx context.Context,
	transactionId int32,
	success bool,
) error

type ContextHubCallbackStub

type ContextHubCallbackStub struct {
	Impl      IContextHubCallback
	Transport binder.VersionAwareTransport
}

ContextHubCallbackStub dispatches incoming binder transactions to a typed IContextHubCallback implementation.

func (*ContextHubCallbackStub) Descriptor

func (s *ContextHubCallbackStub) Descriptor() string

func (*ContextHubCallbackStub) OnTransaction

func (s *ContextHubCallbackStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

type ContextHubInfo

type ContextHubInfo struct {
	Name                           string
	Vendor                         string
	Toolchain                      string
	Id                             int32
	PeakMips                       float32
	MaxSupportedMessageLengthBytes int32
	ChrePlatformId                 int64
	ChreApiMajorVersion            byte
	ChreApiMinorVersion            byte
	ChrePatchVersion               uint16
	SupportedPermissions           []string
	SupportsReliableMessages       bool
}

func (*ContextHubInfo) MarshalParcel

func (s *ContextHubInfo) MarshalParcel(
	p *parcel.Parcel,
) error

func (*ContextHubInfo) UnmarshalParcel

func (s *ContextHubInfo) UnmarshalParcel(
	p *parcel.Parcel,
) error

type ContextHubMessage

type ContextHubMessage struct {
	NanoappId             int64
	HostEndPoint          uint16
	MessageType           int32
	MessageBody           []byte
	Permissions           []string
	IsReliable            bool
	MessageSequenceNumber int32
}

func (*ContextHubMessage) MarshalParcel

func (s *ContextHubMessage) MarshalParcel(
	p *parcel.Parcel,
) error

func (*ContextHubMessage) UnmarshalParcel

func (s *ContextHubMessage) UnmarshalParcel(
	p *parcel.Parcel,
) error

type ContextHubProxy

type ContextHubProxy struct {
	Remote binder.IBinder
}

func NewContextHubProxy

func NewContextHubProxy(
	remote binder.IBinder,
) *ContextHubProxy

func (*ContextHubProxy) AsBinder

func (p *ContextHubProxy) AsBinder() binder.IBinder

func (*ContextHubProxy) DisableNanoapp

func (p *ContextHubProxy) DisableNanoapp(
	ctx context.Context,
	contextHubId int32,
	appId int64,
	transactionId int32,
) error

func (*ContextHubProxy) EnableNanoapp

func (p *ContextHubProxy) EnableNanoapp(
	ctx context.Context,
	contextHubId int32,
	appId int64,
	transactionId int32,
) error

func (*ContextHubProxy) GetContextHubs

func (p *ContextHubProxy) GetContextHubs(
	ctx context.Context,
) ([]ContextHubInfo, error)

func (*ContextHubProxy) GetPreloadedNanoappIds

func (p *ContextHubProxy) GetPreloadedNanoappIds(
	ctx context.Context,
	contextHubId int32,
) ([]int64, error)

func (*ContextHubProxy) LoadNanoapp

func (p *ContextHubProxy) LoadNanoapp(
	ctx context.Context,
	contextHubId int32,
	appBinary NanoappBinary,
	transactionId int32,
) error

func (*ContextHubProxy) OnHostEndpointConnected

func (p *ContextHubProxy) OnHostEndpointConnected(
	ctx context.Context,
	hostEndpointInfo HostEndpointInfo,
) error

func (*ContextHubProxy) OnHostEndpointDisconnected

func (p *ContextHubProxy) OnHostEndpointDisconnected(
	ctx context.Context,
	hostEndpointId uint16,
) error

func (*ContextHubProxy) OnNanSessionStateChanged

func (p *ContextHubProxy) OnNanSessionStateChanged(
	ctx context.Context,
	update NanSessionStateUpdate,
) error

func (*ContextHubProxy) OnSettingChanged

func (p *ContextHubProxy) OnSettingChanged(
	ctx context.Context,
	setting Setting,
	enabled bool,
) error

func (*ContextHubProxy) QueryNanoapps

func (p *ContextHubProxy) QueryNanoapps(
	ctx context.Context,
	contextHubId int32,
) error

func (*ContextHubProxy) RegisterCallback

func (p *ContextHubProxy) RegisterCallback(
	ctx context.Context,
	contextHubId int32,
	cb IContextHubCallback,
) error

func (*ContextHubProxy) SendMessageDeliveryStatusToHub

func (p *ContextHubProxy) SendMessageDeliveryStatusToHub(
	ctx context.Context,
	contextHubId int32,
	messageDeliveryStatus MessageDeliveryStatus,
) error

func (*ContextHubProxy) SendMessageToHub

func (p *ContextHubProxy) SendMessageToHub(
	ctx context.Context,
	contextHubId int32,
	message ContextHubMessage,
) error

func (*ContextHubProxy) SetTestMode

func (p *ContextHubProxy) SetTestMode(
	ctx context.Context,
	enable bool,
) error

func (*ContextHubProxy) UnloadNanoapp

func (p *ContextHubProxy) UnloadNanoapp(
	ctx context.Context,
	contextHubId int32,
	appId int64,
	transactionId int32,
) error

type ContextHubStub

type ContextHubStub struct {
	Impl      IContextHub
	Transport binder.VersionAwareTransport
}

ContextHubStub dispatches incoming binder transactions to a typed IContextHub implementation.

func (*ContextHubStub) Descriptor

func (s *ContextHubStub) Descriptor() string

func (*ContextHubStub) OnTransaction

func (s *ContextHubStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

type ErrorCode

type ErrorCode byte
const (
	ErrorCodeOK                  ErrorCode = 0
	ErrorCodeTransientError      ErrorCode = 1
	ErrorCodePermanentError      ErrorCode = 2
	ErrorCodePermissionDenied    ErrorCode = 3
	ErrorCodeDestinationNotFound ErrorCode = 4
)

type HostEndpointInfo

type HostEndpointInfo struct {
	HostEndpointId uint16
	Type           HostEndpointInfoType
	PackageName    string
	AttributionTag string
}

func (*HostEndpointInfo) MarshalParcel

func (s *HostEndpointInfo) MarshalParcel(
	p *parcel.Parcel,
) error

func (*HostEndpointInfo) UnmarshalParcel

func (s *HostEndpointInfo) UnmarshalParcel(
	p *parcel.Parcel,
) error

type HostEndpointInfoType

type HostEndpointInfoType int32
const (
	HostEndpointInfoTypeFRAMEWORK HostEndpointInfoType = 1
	HostEndpointInfoTypeAPP       HostEndpointInfoType = 2
	HostEndpointInfoTypeNATIVE    HostEndpointInfoType = 3
)

type IContextHub

type IContextHub interface {
	AsBinder() binder.IBinder
	GetContextHubs(ctx context.Context) ([]ContextHubInfo, error)
	LoadNanoapp(ctx context.Context, contextHubId int32, appBinary NanoappBinary, transactionId int32) error
	UnloadNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
	DisableNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
	EnableNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
	OnSettingChanged(ctx context.Context, setting Setting, enabled bool) error
	QueryNanoapps(ctx context.Context, contextHubId int32) error
	RegisterCallback(ctx context.Context, contextHubId int32, cb IContextHubCallback) error
	SendMessageToHub(ctx context.Context, contextHubId int32, message ContextHubMessage) error
	OnHostEndpointConnected(ctx context.Context, hostEndpointInfo HostEndpointInfo) error
	OnHostEndpointDisconnected(ctx context.Context, hostEndpointId uint16) error
	GetPreloadedNanoappIds(ctx context.Context, contextHubId int32) ([]int64, error)
	OnNanSessionStateChanged(ctx context.Context, update NanSessionStateUpdate) error
	SetTestMode(ctx context.Context, enable bool) error
	SendMessageDeliveryStatusToHub(ctx context.Context, contextHubId int32, messageDeliveryStatus MessageDeliveryStatus) error
}

func NewContextHubStub

func NewContextHubStub(
	impl IContextHubServer,
) IContextHub

NewContextHubStub creates a server-side IContextHub wrapping the given server implementation. The returned value satisfies IContextHub and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IContextHubCallback

type IContextHubCallback interface {
	AsBinder() binder.IBinder
	HandleNanoappInfo(ctx context.Context, appInfo []NanoappInfo) error
	HandleContextHubMessage(ctx context.Context, msg ContextHubMessage, msgContentPerms []string) error
	HandleContextHubAsyncEvent(ctx context.Context, evt AsyncEventType) error
	HandleTransactionResult(ctx context.Context, transactionId int32, success bool) error
	HandleNanSessionRequest(ctx context.Context, request NanSessionRequest) error
	HandleMessageDeliveryStatus(ctx context.Context, hostEndpointId uint16, messageDeliveryStatus MessageDeliveryStatus) error
	GetUuid(ctx context.Context) ([]byte, error)
	GetName(ctx context.Context) (string, error)
}

func NewContextHubCallbackStub

func NewContextHubCallbackStub(
	impl IContextHubCallbackServer,
) IContextHubCallback

NewContextHubCallbackStub creates a server-side IContextHubCallback wrapping the given server implementation. The returned value satisfies IContextHubCallback and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IContextHubCallbackServer

type IContextHubCallbackServer interface {
	HandleNanoappInfo(ctx context.Context, appInfo []NanoappInfo) error
	HandleContextHubMessage(ctx context.Context, msg ContextHubMessage, msgContentPerms []string) error
	HandleContextHubAsyncEvent(ctx context.Context, evt AsyncEventType) error
	HandleTransactionResult(ctx context.Context, transactionId int32, success bool) error
	HandleNanSessionRequest(ctx context.Context, request NanSessionRequest) error
	HandleMessageDeliveryStatus(ctx context.Context, hostEndpointId uint16, messageDeliveryStatus MessageDeliveryStatus) error
	GetUuid(ctx context.Context) ([]byte, error)
	GetName(ctx context.Context) (string, error)
}

IContextHubCallbackServer is the server-side interface that user implementations provide to NewContextHubCallbackStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type IContextHubServer

type IContextHubServer interface {
	GetContextHubs(ctx context.Context) ([]ContextHubInfo, error)
	LoadNanoapp(ctx context.Context, contextHubId int32, appBinary NanoappBinary, transactionId int32) error
	UnloadNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
	DisableNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
	EnableNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
	OnSettingChanged(ctx context.Context, setting Setting, enabled bool) error
	QueryNanoapps(ctx context.Context, contextHubId int32) error
	RegisterCallback(ctx context.Context, contextHubId int32, cb IContextHubCallback) error
	SendMessageToHub(ctx context.Context, contextHubId int32, message ContextHubMessage) error
	OnHostEndpointConnected(ctx context.Context, hostEndpointInfo HostEndpointInfo) error
	OnHostEndpointDisconnected(ctx context.Context, hostEndpointId uint16) error
	GetPreloadedNanoappIds(ctx context.Context, contextHubId int32) ([]int64, error)
	OnNanSessionStateChanged(ctx context.Context, update NanSessionStateUpdate) error
	SetTestMode(ctx context.Context, enable bool) error
	SendMessageDeliveryStatusToHub(ctx context.Context, contextHubId int32, messageDeliveryStatus MessageDeliveryStatus) error
}

IContextHubServer is the server-side interface that user implementations provide to NewContextHubStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type MessageDeliveryStatus

type MessageDeliveryStatus struct {
	MessageSequenceNumber int32
	ErrorCode             ErrorCode
}

func (*MessageDeliveryStatus) MarshalParcel

func (s *MessageDeliveryStatus) MarshalParcel(
	p *parcel.Parcel,
) error

func (*MessageDeliveryStatus) UnmarshalParcel

func (s *MessageDeliveryStatus) UnmarshalParcel(
	p *parcel.Parcel,
) error

type NanSessionRequest

type NanSessionRequest struct {
	Enable bool
}

func (*NanSessionRequest) MarshalParcel

func (s *NanSessionRequest) MarshalParcel(
	p *parcel.Parcel,
) error

func (*NanSessionRequest) UnmarshalParcel

func (s *NanSessionRequest) UnmarshalParcel(
	p *parcel.Parcel,
) error

type NanSessionStateUpdate

type NanSessionStateUpdate struct {
	State bool
}

func (*NanSessionStateUpdate) MarshalParcel

func (s *NanSessionStateUpdate) MarshalParcel(
	p *parcel.Parcel,
) error

func (*NanSessionStateUpdate) UnmarshalParcel

func (s *NanSessionStateUpdate) UnmarshalParcel(
	p *parcel.Parcel,
) error

type NanoappBinary

type NanoappBinary struct {
	NanoappId                 int64
	NanoappVersion            int32
	Flags                     int32
	TargetChreApiMajorVersion byte
	TargetChreApiMinorVersion byte
	CustomBinary              []byte
}

func (*NanoappBinary) MarshalParcel

func (s *NanoappBinary) MarshalParcel(
	p *parcel.Parcel,
) error

func (*NanoappBinary) UnmarshalParcel

func (s *NanoappBinary) UnmarshalParcel(
	p *parcel.Parcel,
) error

type NanoappInfo

type NanoappInfo struct {
	NanoappId      int64
	NanoappVersion int32
	Enabled        bool
	Permissions    []string
	RpcServices    []NanoappRpcService
}

func (*NanoappInfo) MarshalParcel

func (s *NanoappInfo) MarshalParcel(
	p *parcel.Parcel,
) error

func (*NanoappInfo) UnmarshalParcel

func (s *NanoappInfo) UnmarshalParcel(
	p *parcel.Parcel,
) error

type NanoappRpcService

type NanoappRpcService struct {
	Id      int64
	Version int32
}

func (*NanoappRpcService) MarshalParcel

func (s *NanoappRpcService) MarshalParcel(
	p *parcel.Parcel,
) error

func (*NanoappRpcService) UnmarshalParcel

func (s *NanoappRpcService) UnmarshalParcel(
	p *parcel.Parcel,
) error

type Setting

type Setting byte
const (
	SettingLOCATION     Setting = 1
	SettingWifiMain     Setting = 2
	SettingWifiScanning Setting = 3
	SettingAirplaneMode Setting = 4
	SettingMICROPHONE   Setting = 5
	SettingBtMain       Setting = 6
	SettingBtScanning   Setting = 7
)

Jump to

Keyboard shortcuts

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