From b5583e233e5d5f2a38e8897e9824cb3eaa7e87dd Mon Sep 17 00:00:00 2001 From: Burcu Dogan Date: Wed, 12 Aug 2015 10:16:13 -0700 Subject: [PATCH] exp/sensor: reorg package to create space for darwin/arm,arm64 impl Change-Id: I41e4088a92fff2f411dd82102fc3c421d2679c21 Reviewed-on: https://go-review.googlesource.com/13582 Reviewed-by: David Crawshaw --- exp/sensor/{sensors_android.c => android.c} | 4 ++- exp/sensor/{sensor_android.go => android.go} | 4 ++- exp/sensor/{sensors_android.h => android.h} | 2 ++ .../{sensor_notandroid.go => darwin_armx.go} | 3 +- exp/sensor/notmobile.go | 34 +++++++++++++++++++ 5 files changed, 44 insertions(+), 3 deletions(-) rename exp/sensor/{sensors_android.c => android.c} (98%) rename exp/sensor/{sensor_android.go => android.go} (99%) rename exp/sensor/{sensors_android.h => android.h} (97%) rename exp/sensor/{sensor_notandroid.go => darwin_armx.go} (94%) create mode 100644 exp/sensor/notmobile.go diff --git a/exp/sensor/sensors_android.c b/exp/sensor/android.c similarity index 98% rename from exp/sensor/sensors_android.c rename to exp/sensor/android.c index 2a6d597..af53ca2 100644 --- a/exp/sensor/sensors_android.c +++ b/exp/sensor/android.c @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build android + #include #include #include -#include "sensors_android.h" +#include "android.h" void android_createManager(int looperId, android_SensorManager* dst) { ASensorManager* manager = ASensorManager_getInstance(); diff --git a/exp/sensor/sensor_android.go b/exp/sensor/android.go similarity index 99% rename from exp/sensor/sensor_android.go rename to exp/sensor/android.go index b7f4255..006d46e 100644 --- a/exp/sensor/sensor_android.go +++ b/exp/sensor/android.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build android + package sensor /* @@ -10,7 +12,7 @@ package sensor #include #include -#include "sensors_android.h" +#include "android.h" */ import "C" import ( diff --git a/exp/sensor/sensors_android.h b/exp/sensor/android.h similarity index 97% rename from exp/sensor/sensors_android.h rename to exp/sensor/android.h index 6f7d820..96cc758 100644 --- a/exp/sensor/sensors_android.h +++ b/exp/sensor/android.h @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build android + #ifndef SENSORS_ANDROID_H #define SENSORS_ANDROID_H diff --git a/exp/sensor/sensor_notandroid.go b/exp/sensor/darwin_armx.go similarity index 94% rename from exp/sensor/sensor_notandroid.go rename to exp/sensor/darwin_armx.go index 5a05ce8..ee95919 100644 --- a/exp/sensor/sensor_notandroid.go +++ b/exp/sensor/darwin_armx.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !android +// +build darwin +// +build arm arm64 package sensor diff --git a/exp/sensor/notmobile.go b/exp/sensor/notmobile.go new file mode 100644 index 0000000..7e3acc6 --- /dev/null +++ b/exp/sensor/notmobile.go @@ -0,0 +1,34 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux,!android darwin,!arm,!arm64 + +package sensor + +import ( + "errors" + "time" +) + +type manager struct { +} + +func (m *manager) initialize() { +} + +func (m *manager) enable(t Type, delay time.Duration) error { + return errors.New("sensor: no sensors available") +} + +func (m *manager) disable(t Type) error { + return errors.New("sensor: no sensors available") +} + +func (m *manager) read(e []Event) (n int, err error) { + return 0, errors.New("sensor: no sensor data available") +} + +func (m *manager) close() error { + return nil +}