sensors

package
v0.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AdditionalInfoAdditionalInfoPayloadTagDataInt32 int32 = 0
	AdditionalInfoAdditionalInfoPayloadTagDataFloat int32 = 1
)
View Source
const (
	EventEventPayloadTagVec3                int32 = 0
	EventEventPayloadTagVec4                int32 = 1
	EventEventPayloadTagUncal               int32 = 2
	EventEventPayloadTagMeta                int32 = 3
	EventEventPayloadTagScalar              int32 = 4
	EventEventPayloadTagStepCount           int32 = 5
	EventEventPayloadTagHeartRate           int32 = 6
	EventEventPayloadTagPose6DOF            int32 = 7
	EventEventPayloadTagDynamic             int32 = 8
	EventEventPayloadTagAdditional          int32 = 9
	EventEventPayloadTagData                int32 = 10
	EventEventPayloadTagHeadTracker         int32 = 11
	EventEventPayloadTagLimitedAxesImu      int32 = 12
	EventEventPayloadTagLimitedAxesImuUncal int32 = 13
	EventEventPayloadTagHeading             int32 = 14
)
View Source
const (
	TransactionISensorsActivate                = binder.FirstCallTransaction + 0
	TransactionISensorsBatch                   = binder.FirstCallTransaction + 1
	TransactionISensorsConfigDirectReport      = binder.FirstCallTransaction + 2
	TransactionISensorsFlush                   = binder.FirstCallTransaction + 3
	TransactionISensorsGetSensorsList          = binder.FirstCallTransaction + 4
	TransactionISensorsInitialize              = binder.FirstCallTransaction + 5
	TransactionISensorsInjectSensorData        = binder.FirstCallTransaction + 6
	TransactionISensorsRegisterDirectChannel   = binder.FirstCallTransaction + 7
	TransactionISensorsSetOperationMode        = binder.FirstCallTransaction + 8
	TransactionISensorsUnregisterDirectChannel = binder.FirstCallTransaction + 9
)
View Source
const (
	MethodISensorsActivate                = "activate"
	MethodISensorsBatch                   = "batch"
	MethodISensorsConfigDirectReport      = "configDirectReport"
	MethodISensorsFlush                   = "flush"
	MethodISensorsGetSensorsList          = "getSensorsList"
	MethodISensorsInitialize              = "initialize"
	MethodISensorsInjectSensorData        = "injectSensorData"
	MethodISensorsRegisterDirectChannel   = "registerDirectChannel"
	MethodISensorsSetOperationMode        = "setOperationMode"
	MethodISensorsUnregisterDirectChannel = "unregisterDirectChannel"
)
View Source
const (
	ISensorsErrorNoMemory                                  int32 = -12
	ISensorsErrorBadValue                                  int32 = -22
	ISensorsWakeLockTimeoutSeconds                         int32 = 1
	ISensorsEventQueueFlagBitsReadAndProcess               int32 = (1 << 0)
	ISensorsEventQueueFlagBitsEventsRead                   int32 = (1 << 1)
	ISensorsWakeLockQueueFlagBitsDataWritten               int32 = (1 << 0)
	ISensorsDirectReportSensorEventOffsetSizeField         int32 = 0
	ISensorsDirectReportSensorEventOffsetSizeReportToken   int32 = 4
	ISensorsDirectReportSensorEventOffsetSizeSensorType    int32 = 8
	ISensorsDirectReportSensorEventOffsetSizeAtomicCounter int32 = 12
	ISensorsDirectReportSensorEventOffsetSizeTimestamp     int32 = 16
	ISensorsDirectReportSensorEventOffsetSizeData          int32 = 24
	ISensorsDirectReportSensorEventOffsetSizeReserved      int32 = 88
	ISensorsDirectReportSensorEventTotalLength             int32 = 104
	ISensorsRuntimeSensorsHandleBase                       int32 = 1593835520
	ISensorsRuntimeSensorsHandleEnd                        int32 = 1610612735
)
View Source
const (
	TransactionISensorsCallbackOnDynamicSensorsConnected    = binder.FirstCallTransaction + 0
	TransactionISensorsCallbackOnDynamicSensorsDisconnected = binder.FirstCallTransaction + 1
)
View Source
const (
	MethodISensorsCallbackOnDynamicSensorsConnected    = "onDynamicSensorsConnected"
	MethodISensorsCallbackOnDynamicSensorsDisconnected = "onDynamicSensorsDisconnected"
)
View Source
const (
	SensorInfoSensorFlagBitsWakeUp               int32 = 1
	SensorInfoSensorFlagBitsContinuousMode       int32 = 0
	SensorInfoSensorFlagBitsOnChangeMode         int32 = 2
	SensorInfoSensorFlagBitsOneShotMode          int32 = 4
	SensorInfoSensorFlagBitsSpecialReportingMode int32 = 6
	SensorInfoSensorFlagBitsDataInjection        int32 = 16
	SensorInfoSensorFlagBitsDynamicSensor        int32 = 32
	SensorInfoSensorFlagBitsAdditionalInfo       int32 = 64
	SensorInfoSensorFlagBitsDirectChannelAshmem  int32 = 1024
	SensorInfoSensorFlagBitsDirectChannelGralloc int32 = 2048
	SensorInfoSensorFlagBitsMaskReportingMode    int32 = 14
	SensorInfoSensorFlagBitsMaskDirectReport     int32 = 896
	SensorInfoSensorFlagBitsMaskDirectChannel    int32 = 3072
	SensorInfoSensorFlagShiftReportingMode       int32 = 1
	SensorInfoSensorFlagShiftDataInjection       int32 = 4
	SensorInfoSensorFlagShiftDynamicSensor       int32 = 5
	SensorInfoSensorFlagShiftAdditionalInfo      int32 = 6
	SensorInfoSensorFlagShiftDirectReport        int32 = 7
	SensorInfoSensorFlagShiftDirectChannel       int32 = 10
)
View Source
const DescriptorISensors = "android.hardware.sensors.ISensors"
View Source
const DescriptorISensorsCallback = "android.hardware.sensors.ISensorsCallback"

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalInfo

type AdditionalInfo struct {
	Type    AdditionalInfoAdditionalInfoType
	Serial  int32
	Payload AdditionalInfoAdditionalInfoPayload
}

func (*AdditionalInfo) MarshalParcel

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

func (*AdditionalInfo) UnmarshalParcel

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

type AdditionalInfoAdditionalInfoPayload

type AdditionalInfoAdditionalInfoPayload struct {
	Tag       int32
	DataInt32 AdditionalInfoAdditionalInfoPayloadInt32Values
	DataFloat AdditionalInfoAdditionalInfoPayloadFloatValues
}

func (*AdditionalInfoAdditionalInfoPayload) GetDataFloat

func (*AdditionalInfoAdditionalInfoPayload) GetDataInt32

func (*AdditionalInfoAdditionalInfoPayload) MarshalParcel

func (u *AdditionalInfoAdditionalInfoPayload) MarshalParcel(
	p *parcel.Parcel,
) error

func (*AdditionalInfoAdditionalInfoPayload) SetDataFloat

func (*AdditionalInfoAdditionalInfoPayload) SetDataInt32

func (*AdditionalInfoAdditionalInfoPayload) UnmarshalParcel

func (u *AdditionalInfoAdditionalInfoPayload) UnmarshalParcel(
	p *parcel.Parcel,
) error

type AdditionalInfoAdditionalInfoPayloadFloatValues

type AdditionalInfoAdditionalInfoPayloadFloatValues struct {
	Values []float32
}

func (*AdditionalInfoAdditionalInfoPayloadFloatValues) MarshalParcel

func (*AdditionalInfoAdditionalInfoPayloadFloatValues) UnmarshalParcel

type AdditionalInfoAdditionalInfoPayloadInt32Values

type AdditionalInfoAdditionalInfoPayloadInt32Values struct {
	Values []int32
}

func (*AdditionalInfoAdditionalInfoPayloadInt32Values) MarshalParcel

func (*AdditionalInfoAdditionalInfoPayloadInt32Values) UnmarshalParcel

type AdditionalInfoAdditionalInfoType

type AdditionalInfoAdditionalInfoType int32
const (
	AdditionalInfoAdditionalInfoTypeAinfoBegin                    AdditionalInfoAdditionalInfoType = 0
	AdditionalInfoAdditionalInfoTypeAinfoEnd                      AdditionalInfoAdditionalInfoType = 1
	AdditionalInfoAdditionalInfoTypeAinfoUntrackedDelay           AdditionalInfoAdditionalInfoType = 65536
	AdditionalInfoAdditionalInfoTypeAinfoInternalTemperature      AdditionalInfoAdditionalInfoType = 65537
	AdditionalInfoAdditionalInfoTypeAinfoVec3Calibration          AdditionalInfoAdditionalInfoType = 65538
	AdditionalInfoAdditionalInfoTypeAinfoSensorPlacement          AdditionalInfoAdditionalInfoType = 65539
	AdditionalInfoAdditionalInfoTypeAinfoSampling                 AdditionalInfoAdditionalInfoType = 65540
	AdditionalInfoAdditionalInfoTypeAinfoChannelNoise             AdditionalInfoAdditionalInfoType = 131072
	AdditionalInfoAdditionalInfoTypeAinfoChannelSampler           AdditionalInfoAdditionalInfoType = 131073
	AdditionalInfoAdditionalInfoTypeAinfoChannelFilter            AdditionalInfoAdditionalInfoType = 131074
	AdditionalInfoAdditionalInfoTypeAinfoChannelLinearTransform   AdditionalInfoAdditionalInfoType = 131075
	AdditionalInfoAdditionalInfoTypeAinfoChannelNonlinearMap      AdditionalInfoAdditionalInfoType = 131076
	AdditionalInfoAdditionalInfoTypeAinfoChannelResampler         AdditionalInfoAdditionalInfoType = 131077
	AdditionalInfoAdditionalInfoTypeAinfoLocalGeomagneticField    AdditionalInfoAdditionalInfoType = 196608
	AdditionalInfoAdditionalInfoTypeAinfoLocalGravity             AdditionalInfoAdditionalInfoType = 196609
	AdditionalInfoAdditionalInfoTypeAinfoDockState                AdditionalInfoAdditionalInfoType = 196610
	AdditionalInfoAdditionalInfoTypeAinfoHighPerformanceMode      AdditionalInfoAdditionalInfoType = 196611
	AdditionalInfoAdditionalInfoTypeAinfoMagneticFieldCalibration AdditionalInfoAdditionalInfoType = 196612
	AdditionalInfoAdditionalInfoTypeAinfoCustomStart              AdditionalInfoAdditionalInfoType = 268435456
	AdditionalInfoAdditionalInfoTypeAinfoDebuggingStart           AdditionalInfoAdditionalInfoType = 1073741824
)

type DynamicSensorInfo

type DynamicSensorInfo struct {
	Connected    bool
	SensorHandle int32
	Uuid         DynamicSensorInfoUuid
}

func (*DynamicSensorInfo) MarshalParcel

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

func (*DynamicSensorInfo) UnmarshalParcel

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

type DynamicSensorInfoUuid

type DynamicSensorInfoUuid struct {
	Values []byte
}

func (*DynamicSensorInfoUuid) MarshalParcel

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

func (*DynamicSensorInfoUuid) UnmarshalParcel

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

type Event

type Event struct {
	Timestamp    int64
	SensorHandle int32
	SensorType   SensorType
	Payload      EventEventPayload
}

func (*Event) MarshalParcel

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

func (*Event) UnmarshalParcel

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

type EventEventPayload

func (*EventEventPayload) GetAdditional

func (u *EventEventPayload) GetAdditional() (AdditionalInfo, bool)

func (*EventEventPayload) GetData

func (*EventEventPayload) GetDynamic

func (u *EventEventPayload) GetDynamic() (DynamicSensorInfo, bool)

func (*EventEventPayload) GetHeadTracker

func (u *EventEventPayload) GetHeadTracker() (EventEventPayloadHeadTracker, bool)

func (*EventEventPayload) GetHeading

func (u *EventEventPayload) GetHeading() (EventEventPayloadHeading, bool)

func (*EventEventPayload) GetHeartRate

func (u *EventEventPayload) GetHeartRate() (EventEventPayloadHeartRate, bool)

func (*EventEventPayload) GetLimitedAxesImu

func (u *EventEventPayload) GetLimitedAxesImu() (EventEventPayloadLimitedAxesImu, bool)

func (*EventEventPayload) GetLimitedAxesImuUncal

func (u *EventEventPayload) GetLimitedAxesImuUncal() (EventEventPayloadLimitedAxesImuUncal, bool)

func (*EventEventPayload) GetMeta

func (*EventEventPayload) GetPose6DOF

func (u *EventEventPayload) GetPose6DOF() (EventEventPayloadPose6Dof, bool)

func (*EventEventPayload) GetScalar

func (u *EventEventPayload) GetScalar() (float32, bool)

func (*EventEventPayload) GetStepCount

func (u *EventEventPayload) GetStepCount() (int64, bool)

func (*EventEventPayload) GetUncal

func (*EventEventPayload) GetVec3

func (*EventEventPayload) GetVec4

func (*EventEventPayload) MarshalParcel

func (u *EventEventPayload) MarshalParcel(
	p *parcel.Parcel,
) error

func (*EventEventPayload) SetAdditional

func (u *EventEventPayload) SetAdditional(
	v AdditionalInfo,
)

func (*EventEventPayload) SetData

func (u *EventEventPayload) SetData(
	v EventEventPayloadData,
)

func (*EventEventPayload) SetDynamic

func (u *EventEventPayload) SetDynamic(
	v DynamicSensorInfo,
)

func (*EventEventPayload) SetHeadTracker

func (u *EventEventPayload) SetHeadTracker(
	v EventEventPayloadHeadTracker,
)

func (*EventEventPayload) SetHeading

func (u *EventEventPayload) SetHeading(
	v EventEventPayloadHeading,
)

func (*EventEventPayload) SetHeartRate

func (u *EventEventPayload) SetHeartRate(
	v EventEventPayloadHeartRate,
)

func (*EventEventPayload) SetLimitedAxesImu

func (u *EventEventPayload) SetLimitedAxesImu(
	v EventEventPayloadLimitedAxesImu,
)

func (*EventEventPayload) SetLimitedAxesImuUncal

func (u *EventEventPayload) SetLimitedAxesImuUncal(
	v EventEventPayloadLimitedAxesImuUncal,
)

func (*EventEventPayload) SetMeta

func (*EventEventPayload) SetPose6DOF

func (u *EventEventPayload) SetPose6DOF(
	v EventEventPayloadPose6Dof,
)

func (*EventEventPayload) SetScalar

func (u *EventEventPayload) SetScalar(
	v float32,
)

func (*EventEventPayload) SetStepCount

func (u *EventEventPayload) SetStepCount(
	v int64,
)

func (*EventEventPayload) SetUncal

func (u *EventEventPayload) SetUncal(
	v EventEventPayloadUncal,
)

func (*EventEventPayload) SetVec3

func (u *EventEventPayload) SetVec3(
	v EventEventPayloadVec3,
)

func (*EventEventPayload) SetVec4

func (u *EventEventPayload) SetVec4(
	v EventEventPayloadVec4,
)

func (*EventEventPayload) UnmarshalParcel

func (u *EventEventPayload) UnmarshalParcel(
	p *parcel.Parcel,
) error

type EventEventPayloadData

type EventEventPayloadData struct {
	Values []float32
}

func (*EventEventPayloadData) MarshalParcel

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

func (*EventEventPayloadData) UnmarshalParcel

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

type EventEventPayloadHeadTracker

type EventEventPayloadHeadTracker struct {
	Rx                 float32
	Ry                 float32
	Rz                 float32
	Vx                 float32
	Vy                 float32
	Vz                 float32
	DiscontinuityCount int32
}

func (*EventEventPayloadHeadTracker) MarshalParcel

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

func (*EventEventPayloadHeadTracker) UnmarshalParcel

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

type EventEventPayloadHeading

type EventEventPayloadHeading struct {
	Heading  float32
	Accuracy float32
}

func (*EventEventPayloadHeading) MarshalParcel

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

func (*EventEventPayloadHeading) UnmarshalParcel

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

type EventEventPayloadHeartRate

type EventEventPayloadHeartRate struct {
	Bpm    float32
	Status SensorStatus
}

func (*EventEventPayloadHeartRate) MarshalParcel

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

func (*EventEventPayloadHeartRate) UnmarshalParcel

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

type EventEventPayloadLimitedAxesImu

type EventEventPayloadLimitedAxesImu struct {
	X          float32
	Y          float32
	Z          float32
	XSupported float32
	YSupported float32
	ZSupported float32
}

func (*EventEventPayloadLimitedAxesImu) MarshalParcel

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

func (*EventEventPayloadLimitedAxesImu) UnmarshalParcel

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

type EventEventPayloadLimitedAxesImuUncal

type EventEventPayloadLimitedAxesImuUncal struct {
	X          float32
	Y          float32
	Z          float32
	XBias      float32
	YBias      float32
	ZBias      float32
	XSupported float32
	YSupported float32
	ZSupported float32
}

func (*EventEventPayloadLimitedAxesImuUncal) MarshalParcel

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

func (*EventEventPayloadLimitedAxesImuUncal) UnmarshalParcel

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

type EventEventPayloadMetaData

type EventEventPayloadMetaData struct {
	What EventEventPayloadMetaDataMetaDataEventType
}

func (*EventEventPayloadMetaData) MarshalParcel

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

func (*EventEventPayloadMetaData) UnmarshalParcel

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

type EventEventPayloadMetaDataMetaDataEventType

type EventEventPayloadMetaDataMetaDataEventType int32
const (
	EventEventPayloadMetaDataMetaDataEventTypeMetaDataFlushComplete EventEventPayloadMetaDataMetaDataEventType = 1
)

type EventEventPayloadPose6Dof

type EventEventPayloadPose6Dof struct {
	Values []float32
}

func (*EventEventPayloadPose6Dof) MarshalParcel

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

func (*EventEventPayloadPose6Dof) UnmarshalParcel

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

type EventEventPayloadUncal

type EventEventPayloadUncal struct {
	X     float32
	Y     float32
	Z     float32
	XBias float32
	YBias float32
	ZBias float32
}

func (*EventEventPayloadUncal) MarshalParcel

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

func (*EventEventPayloadUncal) UnmarshalParcel

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

type EventEventPayloadVec3

type EventEventPayloadVec3 struct {
	X      float32
	Y      float32
	Z      float32
	Status SensorStatus
}

func (*EventEventPayloadVec3) MarshalParcel

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

func (*EventEventPayloadVec3) UnmarshalParcel

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

type EventEventPayloadVec4

type EventEventPayloadVec4 struct {
	X float32
	Y float32
	Z float32
	W float32
}

func (*EventEventPayloadVec4) MarshalParcel

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

func (*EventEventPayloadVec4) UnmarshalParcel

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

type ISensors

type ISensors interface {
	AsBinder() binder.IBinder
	Activate(ctx context.Context, sensorHandle int32, enabled bool) error
	Batch(ctx context.Context, sensorHandle int32, samplingPeriodNs int64, maxReportLatencyNs int64) error
	ConfigDirectReport(ctx context.Context, sensorHandle int32, channelHandle int32, rate ISensorsRateLevel) (int32, error)
	Flush(ctx context.Context, sensorHandle int32) error
	GetSensorsList(ctx context.Context) ([]SensorInfo, error)
	Initialize(ctx context.Context, eventQueueDescriptor fmq.MQDescriptor, wakeLockDescriptor fmq.MQDescriptor, sensorsCallback ISensorsCallback) error
	InjectSensorData(ctx context.Context, event Event) error
	RegisterDirectChannel(ctx context.Context, mem ISensorsSharedMemInfo) (int32, error)
	SetOperationMode(ctx context.Context, mode ISensorsOperationMode) error
	UnregisterDirectChannel(ctx context.Context, channelHandle int32) error
}

func NewSensorsStub

func NewSensorsStub(
	impl ISensorsServer,
) ISensors

NewSensorsStub creates a server-side ISensors wrapping the given server implementation. The returned value satisfies ISensors 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 ISensorsCallback

type ISensorsCallback interface {
	AsBinder() binder.IBinder
	OnDynamicSensorsConnected(ctx context.Context, sensorInfos []SensorInfo) error
	OnDynamicSensorsDisconnected(ctx context.Context, sensorHandles []int32) error
}

func NewSensorsCallbackStub

func NewSensorsCallbackStub(
	impl ISensorsCallbackServer,
) ISensorsCallback

NewSensorsCallbackStub creates a server-side ISensorsCallback wrapping the given server implementation. The returned value satisfies ISensorsCallback 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 ISensorsCallbackServer

type ISensorsCallbackServer interface {
	OnDynamicSensorsConnected(ctx context.Context, sensorInfos []SensorInfo) error
	OnDynamicSensorsDisconnected(ctx context.Context, sensorHandles []int32) error
}

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

type ISensorsOperationMode

type ISensorsOperationMode int32
const (
	ISensorsOperationModeNORMAL        ISensorsOperationMode = 0
	ISensorsOperationModeDataInjection ISensorsOperationMode = 1
)

type ISensorsRateLevel

type ISensorsRateLevel int32
const (
	ISensorsRateLevelSTOP     ISensorsRateLevel = 0
	ISensorsRateLevelNORMAL   ISensorsRateLevel = 1
	ISensorsRateLevelFAST     ISensorsRateLevel = 2
	ISensorsRateLevelVeryFast ISensorsRateLevel = 3
)

type ISensorsServer

type ISensorsServer interface {
	Activate(ctx context.Context, sensorHandle int32, enabled bool) error
	Batch(ctx context.Context, sensorHandle int32, samplingPeriodNs int64, maxReportLatencyNs int64) error
	ConfigDirectReport(ctx context.Context, sensorHandle int32, channelHandle int32, rate ISensorsRateLevel) (int32, error)
	Flush(ctx context.Context, sensorHandle int32) error
	GetSensorsList(ctx context.Context) ([]SensorInfo, error)
	Initialize(ctx context.Context, eventQueueDescriptor fmq.MQDescriptor, wakeLockDescriptor fmq.MQDescriptor, sensorsCallback ISensorsCallback) error
	InjectSensorData(ctx context.Context, event Event) error
	RegisterDirectChannel(ctx context.Context, mem ISensorsSharedMemInfo) (int32, error)
	SetOperationMode(ctx context.Context, mode ISensorsOperationMode) error
	UnregisterDirectChannel(ctx context.Context, channelHandle int32) error
}

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

type ISensorsSharedMemInfo

type ISensorsSharedMemInfo struct {
	Type         ISensorsSharedMemInfoSharedMemType
	Format       ISensorsSharedMemInfoSharedMemFormat
	Size         int32
	MemoryHandle common.NativeHandle
}

func (*ISensorsSharedMemInfo) MarshalParcel

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

func (*ISensorsSharedMemInfo) UnmarshalParcel

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

type ISensorsSharedMemInfoSharedMemFormat

type ISensorsSharedMemInfoSharedMemFormat int32
const (
	ISensorsSharedMemInfoSharedMemFormatSensorsEvent ISensorsSharedMemInfoSharedMemFormat = 1
)

type ISensorsSharedMemInfoSharedMemType

type ISensorsSharedMemInfoSharedMemType int32
const (
	ISensorsSharedMemInfoSharedMemTypeASHMEM  ISensorsSharedMemInfoSharedMemType = 1
	ISensorsSharedMemInfoSharedMemTypeGRALLOC ISensorsSharedMemInfoSharedMemType = 2
)

type SensorInfo

type SensorInfo struct {
	SensorHandle           int32
	Name                   string
	Vendor                 string
	Version                int32
	Type                   SensorType
	TypeAsString           string
	MaxRange               float32
	Resolution             float32
	Power                  float32
	MinDelayUs             int32
	FifoReservedEventCount int32
	FifoMaxEventCount      int32
	RequiredPermission     string
	MaxDelayUs             int32
	Flags                  int32
}

func (*SensorInfo) MarshalParcel

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

func (*SensorInfo) UnmarshalParcel

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

type SensorStatus

type SensorStatus byte
const (
	SensorStatusNoContact      SensorStatus = 255
	SensorStatusUNRELIABLE     SensorStatus = 0
	SensorStatusAccuracyLow    SensorStatus = 1
	SensorStatusAccuracyMedium SensorStatus = 2
	SensorStatusAccuracyHigh   SensorStatus = 3
)

type SensorType

type SensorType int32
const (
	SensorTypeMetaData                             SensorType = 0
	SensorTypeACCELEROMETER                        SensorType = 1
	SensorTypeMagneticField                        SensorType = 2
	SensorTypeORIENTATION                          SensorType = 3
	SensorTypeGYROSCOPE                            SensorType = 4
	SensorTypeLIGHT                                SensorType = 5
	SensorTypePRESSURE                             SensorType = 6
	SensorTypePROXIMITY                            SensorType = 8
	SensorTypeGRAVITY                              SensorType = 9
	SensorTypeLinearAcceleration                   SensorType = 10
	SensorTypeRotationVector                       SensorType = 11
	SensorTypeRelativeHumidity                     SensorType = 12
	SensorTypeAmbientTemperature                   SensorType = 13
	SensorTypeMagneticFieldUncalibrated            SensorType = 14
	SensorTypeGameRotationVector                   SensorType = 15
	SensorTypeGyroscopeUncalibrated                SensorType = 16
	SensorTypeSignificantMotion                    SensorType = 17
	SensorTypeStepDetector                         SensorType = 18
	SensorTypeStepCounter                          SensorType = 19
	SensorTypeGeomagneticRotationVector            SensorType = 20
	SensorTypeHeartRate                            SensorType = 21
	SensorTypeTiltDetector                         SensorType = 22
	SensorTypeWakeGesture                          SensorType = 23
	SensorTypeGlanceGesture                        SensorType = 24
	SensorTypePickUpGesture                        SensorType = 25
	SensorTypeWristTiltGesture                     SensorType = 26
	SensorTypeDeviceOrientation                    SensorType = 27
	SensorTypePose6dof                             SensorType = 28
	SensorTypeStationaryDetect                     SensorType = 29
	SensorTypeMotionDetect                         SensorType = 30
	SensorTypeHeartBeat                            SensorType = 31
	SensorTypeDynamicSensorMeta                    SensorType = 32
	SensorTypeAdditionalInfo                       SensorType = 33
	SensorTypeLowLatencyOffbodyDetect              SensorType = 34
	SensorTypeAccelerometerUncalibrated            SensorType = 35
	SensorTypeHingeAngle                           SensorType = 36
	SensorTypeHeadTracker                          SensorType = 37
	SensorTypeAccelerometerLimitedAxes             SensorType = 38
	SensorTypeGyroscopeLimitedAxes                 SensorType = 39
	SensorTypeAccelerometerLimitedAxesUncalibrated SensorType = 40
	SensorTypeGyroscopeLimitedAxesUncalibrated     SensorType = 41
	SensorTypeHEADING                              SensorType = 42
	SensorTypeDevicePrivateBase                    SensorType = 65536
)

type SensorsCallbackProxy

type SensorsCallbackProxy struct {
	Remote binder.IBinder
}

func NewSensorsCallbackProxy

func NewSensorsCallbackProxy(
	remote binder.IBinder,
) *SensorsCallbackProxy

func (*SensorsCallbackProxy) AsBinder

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

func (*SensorsCallbackProxy) OnDynamicSensorsConnected

func (p *SensorsCallbackProxy) OnDynamicSensorsConnected(
	ctx context.Context,
	sensorInfos []SensorInfo,
) error

func (*SensorsCallbackProxy) OnDynamicSensorsDisconnected

func (p *SensorsCallbackProxy) OnDynamicSensorsDisconnected(
	ctx context.Context,
	sensorHandles []int32,
) error

type SensorsCallbackStub

type SensorsCallbackStub struct {
	Impl      ISensorsCallback
	Transport binder.VersionAwareTransport
}

SensorsCallbackStub dispatches incoming binder transactions to a typed ISensorsCallback implementation.

func (*SensorsCallbackStub) Descriptor

func (s *SensorsCallbackStub) Descriptor() string

func (*SensorsCallbackStub) OnTransaction

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

type SensorsProxy

type SensorsProxy struct {
	Remote binder.IBinder
}

func NewSensorsProxy

func NewSensorsProxy(
	remote binder.IBinder,
) *SensorsProxy

func (*SensorsProxy) Activate

func (p *SensorsProxy) Activate(
	ctx context.Context,
	sensorHandle int32,
	enabled bool,
) error

func (*SensorsProxy) AsBinder

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

func (*SensorsProxy) Batch

func (p *SensorsProxy) Batch(
	ctx context.Context,
	sensorHandle int32,
	samplingPeriodNs int64,
	maxReportLatencyNs int64,
) error

func (*SensorsProxy) ConfigDirectReport

func (p *SensorsProxy) ConfigDirectReport(
	ctx context.Context,
	sensorHandle int32,
	channelHandle int32,
	rate ISensorsRateLevel,
) (int32, error)

func (*SensorsProxy) Flush

func (p *SensorsProxy) Flush(
	ctx context.Context,
	sensorHandle int32,
) error

func (*SensorsProxy) GetSensorsList

func (p *SensorsProxy) GetSensorsList(
	ctx context.Context,
) ([]SensorInfo, error)

func (*SensorsProxy) Initialize

func (p *SensorsProxy) Initialize(
	ctx context.Context,
	eventQueueDescriptor fmq.MQDescriptor,
	wakeLockDescriptor fmq.MQDescriptor,
	sensorsCallback ISensorsCallback,
) error

func (*SensorsProxy) InjectSensorData

func (p *SensorsProxy) InjectSensorData(
	ctx context.Context,
	event Event,
) error

func (*SensorsProxy) RegisterDirectChannel

func (p *SensorsProxy) RegisterDirectChannel(
	ctx context.Context,
	mem ISensorsSharedMemInfo,
) (int32, error)

func (*SensorsProxy) SetOperationMode

func (p *SensorsProxy) SetOperationMode(
	ctx context.Context,
	mode ISensorsOperationMode,
) error

func (*SensorsProxy) UnregisterDirectChannel

func (p *SensorsProxy) UnregisterDirectChannel(
	ctx context.Context,
	channelHandle int32,
) error

type SensorsStub

type SensorsStub struct {
	Impl      ISensors
	Transport binder.VersionAwareTransport
}

SensorsStub dispatches incoming binder transactions to a typed ISensors implementation.

func (*SensorsStub) Descriptor

func (s *SensorsStub) Descriptor() string

func (*SensorsStub) OnTransaction

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

Jump to

Keyboard shortcuts

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