Documentation
¶
Index ¶
- Constants
- type AsyncEventType
- type ContextHubCallbackProxy
- func (p *ContextHubCallbackProxy) AsBinder() binder.IBinder
- func (p *ContextHubCallbackProxy) GetName(ctx context.Context) (string, error)
- func (p *ContextHubCallbackProxy) GetUuid(ctx context.Context) ([]byte, error)
- func (p *ContextHubCallbackProxy) HandleContextHubAsyncEvent(ctx context.Context, evt AsyncEventType) error
- func (p *ContextHubCallbackProxy) HandleContextHubMessage(ctx context.Context, msg ContextHubMessage, msgContentPerms []string) error
- func (p *ContextHubCallbackProxy) HandleMessageDeliveryStatus(ctx context.Context, hostEndpointId uint16, ...) error
- func (p *ContextHubCallbackProxy) HandleNanSessionRequest(ctx context.Context, request NanSessionRequest) error
- func (p *ContextHubCallbackProxy) HandleNanoappInfo(ctx context.Context, appInfo []NanoappInfo) error
- func (p *ContextHubCallbackProxy) HandleTransactionResult(ctx context.Context, transactionId int32, success bool) error
- type ContextHubCallbackStub
- type ContextHubInfo
- type ContextHubMessage
- type ContextHubProxy
- func (p *ContextHubProxy) AsBinder() binder.IBinder
- func (p *ContextHubProxy) DisableNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
- func (p *ContextHubProxy) EnableNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
- func (p *ContextHubProxy) GetContextHubs(ctx context.Context) ([]ContextHubInfo, error)
- func (p *ContextHubProxy) GetPreloadedNanoappIds(ctx context.Context, contextHubId int32) ([]int64, error)
- func (p *ContextHubProxy) LoadNanoapp(ctx context.Context, contextHubId int32, appBinary NanoappBinary, ...) error
- func (p *ContextHubProxy) OnHostEndpointConnected(ctx context.Context, hostEndpointInfo HostEndpointInfo) error
- func (p *ContextHubProxy) OnHostEndpointDisconnected(ctx context.Context, hostEndpointId uint16) error
- func (p *ContextHubProxy) OnNanSessionStateChanged(ctx context.Context, update NanSessionStateUpdate) error
- func (p *ContextHubProxy) OnSettingChanged(ctx context.Context, setting Setting, enabled bool) error
- func (p *ContextHubProxy) QueryNanoapps(ctx context.Context, contextHubId int32) error
- func (p *ContextHubProxy) RegisterCallback(ctx context.Context, contextHubId int32, cb IContextHubCallback) error
- func (p *ContextHubProxy) SendMessageDeliveryStatusToHub(ctx context.Context, contextHubId int32, ...) error
- func (p *ContextHubProxy) SendMessageToHub(ctx context.Context, contextHubId int32, message ContextHubMessage) error
- func (p *ContextHubProxy) SetTestMode(ctx context.Context, enable bool) error
- func (p *ContextHubProxy) UnloadNanoapp(ctx context.Context, contextHubId int32, appId int64, transactionId int32) error
- type ContextHubStub
- type ErrorCode
- type HostEndpointInfo
- type HostEndpointInfoType
- type IContextHub
- type IContextHubCallback
- type IContextHubCallbackServer
- type IContextHubServer
- type MessageDeliveryStatus
- type NanSessionRequest
- type NanSessionStateUpdate
- type NanoappBinary
- type NanoappInfo
- type NanoappRpcService
- type Setting
Constants ¶
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 )
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" )
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 )
const ( MethodIContextHubCallbackHandleNanoappInfo = "handleNanoappInfo" MethodIContextHubCallbackHandleContextHubMessage = "handleContextHubMessage" MethodIContextHubCallbackHandleContextHubAsyncEvent = "handleContextHubAsyncEvent" MethodIContextHubCallbackHandleTransactionResult = "handleTransactionResult" MethodIContextHubCallbackHandleNanSessionRequest = "handleNanSessionRequest" MethodIContextHubCallbackHandleMessageDeliveryStatus = "handleMessageDeliveryStatus" MethodIContextHubCallbackGetUuid = "getUuid" MethodIContextHubCallbackGetName = "getName" )
const ( NanoappBinaryFlagSigned int32 = (1 << 0) NanoappBinaryFlagEncrypted int32 = (1 << 1) NanoappBinaryFlagTcmCapable int32 = (1 << 2) )
const DescriptorIContextHub = "android.hardware.contexthub.IContextHub"
const DescriptorIContextHubCallback = "android.hardware.contexthub.IContextHubCallback"
const (
IContextHubCallbackContexthubNanTransactionTimeoutMs int32 = 10000
)
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 ¶
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 ¶
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 ¶
func NewContextHubProxy ¶
func NewContextHubProxy( remote binder.IBinder, ) *ContextHubProxy
func (*ContextHubProxy) AsBinder ¶
func (p *ContextHubProxy) AsBinder() binder.IBinder
func (*ContextHubProxy) DisableNanoapp ¶
func (*ContextHubProxy) EnableNanoapp ¶
func (*ContextHubProxy) GetContextHubs ¶
func (p *ContextHubProxy) GetContextHubs( ctx context.Context, ) ([]ContextHubInfo, error)
func (*ContextHubProxy) GetPreloadedNanoappIds ¶
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 (*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 ¶
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 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 ¶
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 ¶
func (*NanoappRpcService) MarshalParcel ¶
func (s *NanoappRpcService) MarshalParcel( p *parcel.Parcel, ) error
func (*NanoappRpcService) UnmarshalParcel ¶
func (s *NanoappRpcService) UnmarshalParcel( p *parcel.Parcel, ) error