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 {
31 public abstract Point getPoint();
32
45 public abstract int getLocationId();
46
59 public abstract int getSublocationId();
60
73 public abstract String getName();
74
87 public abstract String getNamespaceId();
88
101 public abstract String getInstanceId();
102
115 public abstract Integer getPower();
116
129 public abstract TransmitterStatus getStatus();
130
131 private static final class CppProxy extends Eddystone
132 {
133 private final long nativeRef;
134 private final AtomicBoolean destroyed = new AtomicBoolean(false);
135
136 private CppProxy(long nativeRef)
137 {
138 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
139 this.nativeRef = nativeRef;
140 }
141
142 private native void nativeDestroy(long nativeRef);
143 public void _djinni_private_destroy()
144 {
145 boolean destroyed = this.destroyed.getAndSet(true);
146 if (!destroyed) nativeDestroy(this.nativeRef);
147 }
148 protected void finalize() throws java.lang.Throwable
149 {
150 _djinni_private_destroy();
151 super.finalize();
152 }
153
154 // Eddystone methods
155
156 @Override
157 public Point getPoint()
158 {
159 assert !this.destroyed.get() : "trying to use a destroyed object";
160 return native_getPoint(this.nativeRef);
161 }
162 private native Point native_getPoint(long _nativeRef);
163
164 @Override
165 public int getLocationId()
166 {
167 assert !this.destroyed.get() : "trying to use a destroyed object";
168 return native_getLocationId(this.nativeRef);
169 }
170 private native int native_getLocationId(long _nativeRef);
171
172 @Override
173 public int getSublocationId()
174 {
175 assert !this.destroyed.get() : "trying to use a destroyed object";
176 return native_getSublocationId(this.nativeRef);
177 }
178 private native int native_getSublocationId(long _nativeRef);
179
180 @Override
181 public String getName()
182 {
183 assert !this.destroyed.get() : "trying to use a destroyed object";
184 return native_getName(this.nativeRef);
185 }
186 private native String native_getName(long _nativeRef);
187
188 @Override
189 public String getNamespaceId()
190 {
191 assert !this.destroyed.get() : "trying to use a destroyed object";
192 return native_getNamespaceId(this.nativeRef);
193 }
194 private native String native_getNamespaceId(long _nativeRef);
195
196 @Override
197 public String getInstanceId()
198 {
199 assert !this.destroyed.get() : "trying to use a destroyed object";
200 return native_getInstanceId(this.nativeRef);
201 }
202 private native String native_getInstanceId(long _nativeRef);
203
204 @Override
205 public Integer getPower()
206 {
207 assert !this.destroyed.get() : "trying to use a destroyed object";
208 return native_getPower(this.nativeRef);
209 }
210 private native Integer native_getPower(long _nativeRef);
211
212 @Override
213 public TransmitterStatus getStatus()
214 {
215 assert !this.destroyed.get() : "trying to use a destroyed object";
216 return native_getStatus(this.nativeRef);
217 }
218 private native TransmitterStatus native_getStatus(long _nativeRef);
219 }
220}