반응형

안녕하세요. 

 

빠르게 Estimote의 Beacon 세 개를 이용해 안드로이드 폰으로 삼변측량을 구현하기 위해 AltBeacon Library를 사용했습니다. (Beacon 구현)

 

간단하기 때문에 쉽게 구현할 수 있습니다. 중요한 부분만 집어 이야기 하겠습니다.

 

altbeacon.github.io/android-beacon-library/index.html

 

Android Beacon Library

The leading library for detecting beacons on Android. What Does This Library Do? It allows Android devices to use beacons much like iOS devices do. An app can request to get notifications when one or more beacons appear or disappear. An app can also reques

altbeacon.github.io

 

1. Configure (build.gradle)

최신 버전

 

2. Permissions (AndroidManifest.xml)

안드로이드 버전 별 이슈는 위 사이트 참고

 

 

3. Implements (MainActivity.java)

altbeacon.github.io/android-beacon-library/samples.html

 

Android Beacon Library

Reference Application A minimalist reference application for the Open Source Library is available on GitHub that demonstrates basic ranging and monitoring. It is based on the examples below. Requesting Permission IMPORTANT: Your app must request permission

altbeacon.github.io

 

Ranging Example Code를 사용하여 Distance를 구할 수 있다. ( getDistance() 메소드 사용 )

 

하지만 getDistance 메소드 대신 아래 메소드를 추천합니다. ( 실제 실험 환경의 곡선을 가진 방정식 )

protected static double calculateDistance(int measuredPower, double rssi) {
  if (rssi == 0) {
    return -1.0; // if we cannot determine distance, return -1.
  }
  double ratio = rssi*1.0/measuredPower;
  if (ratio < 1.0) {
    return Math.pow(ratio,10);
  }
  else {
    double distance =  (0.89976)*Math.pow(ratio,7.7095) + 0.111;
    return distance;
  }
}

 

4. Error (AltBeacon 종속성 추가)

오류

Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.localbroadcastmanager.content.LocalBroadcastManager"

 

해결 (build.gradle에 추가)

 implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'

 

 

5. 응용 (Beacon Parser)

Beacon은 대표적으로 Estimote(Apple)와 EddyStone(Google)이 있으므로, Beacon Scan 하기 위한 Beacon을 parsing 해야 한다. 

 

 

위 오픈소스 설명이 굉장히 잘 돼있기 때문에 자세한 설명은 하지 않고, 큰 틀로 이야기를 진행했습니다.

 

iBeacon이 Eddystone보다 약 2년 정도 일찍 출시되어, Beacon 하면 iBeacon을 많이 이야기합니다. 

 

후속작인 Eddystone은 URL을 Broadcasting 하여 주변 기기에게 전송할 수 있고, TLM을 통해 비콘의 상태를 확인할 수 있습니다. 

www.youtube.com/watch?v=HRP1tfXHiVg&t=67s

passkit.com/blog/what-is-eddystone-and-is-it-the-future-of-beacon-tech/

 

What Is Eddystone and Is It The Future Of Beacon Tech?

Back in July, Google released Eddystone, an open source beacon format that is changing the way we use beacons. Here's what you need to know.

passkit.com

 

 

cf) 삼변측량 Library

github.com/lemmingapex/trilateration

 

lemmingapex/trilateration

Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer - lemmingapex/trilateration

github.com

 

728x90
반응형

+ Recent posts