Loading...
Searching...
No Matches
Beacon.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
18public abstract class Beacon {
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 int getMajor();
93
107 public abstract int getMinor();
108
122 public abstract String getUuid();
123
137 public abstract Integer getPower();
138
152 public abstract TransmitterStatus getStatus();
153
154 private static final class CppProxy extends Beacon
155 {
156 private final long nativeRef;
157 private final AtomicBoolean destroyed = new AtomicBoolean(false);
158
159 private CppProxy(long nativeRef)
160 {
161 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
162 this.nativeRef = nativeRef;
163 }
164
165 private native void nativeDestroy(long nativeRef);
166 public void _djinni_private_destroy()
167 {
168 boolean destroyed = this.destroyed.getAndSet(true);
169 if (!destroyed) nativeDestroy(this.nativeRef);
170 }
171 protected void finalize() throws java.lang.Throwable
172 {
173 _djinni_private_destroy();
174 super.finalize();
175 }
176
177 // Beacon methods
178
179 @Override
180 public Point getPoint()
181 {
182 assert !this.destroyed.get() : "trying to use a destroyed object";
183 return native_getPoint(this.nativeRef);
184 }
185 private native Point native_getPoint(long _nativeRef);
186
187 @Override
188 public int getLocationId()
189 {
190 assert !this.destroyed.get() : "trying to use a destroyed object";
191 return native_getLocationId(this.nativeRef);
192 }
193 private native int native_getLocationId(long _nativeRef);
194
195 @Override
196 public int getSublocationId()
197 {
198 assert !this.destroyed.get() : "trying to use a destroyed object";
199 return native_getSublocationId(this.nativeRef);
200 }
201 private native int native_getSublocationId(long _nativeRef);
202
203 @Override
204 public String getName()
205 {
206 assert !this.destroyed.get() : "trying to use a destroyed object";
207 return native_getName(this.nativeRef);
208 }
209 private native String native_getName(long _nativeRef);
210
211 @Override
212 public int getMajor()
213 {
214 assert !this.destroyed.get() : "trying to use a destroyed object";
215 return native_getMajor(this.nativeRef);
216 }
217 private native int native_getMajor(long _nativeRef);
218
219 @Override
220 public int getMinor()
221 {
222 assert !this.destroyed.get() : "trying to use a destroyed object";
223 return native_getMinor(this.nativeRef);
224 }
225 private native int native_getMinor(long _nativeRef);
226
227 @Override
228 public String getUuid()
229 {
230 assert !this.destroyed.get() : "trying to use a destroyed object";
231 return native_getUuid(this.nativeRef);
232 }
233 private native String native_getUuid(long _nativeRef);
234
235 @Override
236 public Integer getPower()
237 {
238 assert !this.destroyed.get() : "trying to use a destroyed object";
239 return native_getPower(this.nativeRef);
240 }
241 private native Integer native_getPower(long _nativeRef);
242
243 @Override
244 public TransmitterStatus getStatus()
245 {
246 assert !this.destroyed.get() : "trying to use a destroyed object";
247 return native_getStatus(this.nativeRef);
248 }
249 private native TransmitterStatus native_getStatus(long _nativeRef);
250 }
251}