Loading...
Searching...
No Matches
Eddystone.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
18public abstract class Eddystone {
32 public abstract Point getPoint();
33
47 public abstract int getLocationId();
48
62 public abstract int getSublocationId();
63
77 public abstract String getName();
78
92 public abstract String getNamespaceId();
93
107 public abstract String getInstanceId();
108
122 public abstract Integer getPower();
123
137 public abstract TransmitterStatus getStatus();
138
139 private static final class CppProxy extends Eddystone
140 {
141 private final long nativeRef;
142 private final AtomicBoolean destroyed = new AtomicBoolean(false);
143
144 private CppProxy(long nativeRef)
145 {
146 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
147 this.nativeRef = nativeRef;
148 }
149
150 private native void nativeDestroy(long nativeRef);
151 public void _djinni_private_destroy()
152 {
153 boolean destroyed = this.destroyed.getAndSet(true);
154 if (!destroyed) nativeDestroy(this.nativeRef);
155 }
156 protected void finalize() throws java.lang.Throwable
157 {
158 _djinni_private_destroy();
159 super.finalize();
160 }
161
162 // Eddystone methods
163
164 @Override
165 public Point getPoint()
166 {
167 assert !this.destroyed.get() : "trying to use a destroyed object";
168 return native_getPoint(this.nativeRef);
169 }
170 private native Point native_getPoint(long _nativeRef);
171
172 @Override
173 public int getLocationId()
174 {
175 assert !this.destroyed.get() : "trying to use a destroyed object";
176 return native_getLocationId(this.nativeRef);
177 }
178 private native int native_getLocationId(long _nativeRef);
179
180 @Override
181 public int getSublocationId()
182 {
183 assert !this.destroyed.get() : "trying to use a destroyed object";
184 return native_getSublocationId(this.nativeRef);
185 }
186 private native int native_getSublocationId(long _nativeRef);
187
188 @Override
189 public String getName()
190 {
191 assert !this.destroyed.get() : "trying to use a destroyed object";
192 return native_getName(this.nativeRef);
193 }
194 private native String native_getName(long _nativeRef);
195
196 @Override
197 public String getNamespaceId()
198 {
199 assert !this.destroyed.get() : "trying to use a destroyed object";
200 return native_getNamespaceId(this.nativeRef);
201 }
202 private native String native_getNamespaceId(long _nativeRef);
203
204 @Override
205 public String getInstanceId()
206 {
207 assert !this.destroyed.get() : "trying to use a destroyed object";
208 return native_getInstanceId(this.nativeRef);
209 }
210 private native String native_getInstanceId(long _nativeRef);
211
212 @Override
213 public Integer getPower()
214 {
215 assert !this.destroyed.get() : "trying to use a destroyed object";
216 return native_getPower(this.nativeRef);
217 }
218 private native Integer native_getPower(long _nativeRef);
219
220 @Override
221 public TransmitterStatus getStatus()
222 {
223 assert !this.destroyed.get() : "trying to use a destroyed object";
224 return native_getStatus(this.nativeRef);
225 }
226 private native TransmitterStatus native_getStatus(long _nativeRef);
227 }
228}