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 {
22 public abstract Point getPoint();
23
27 public abstract int getLocationId();
28
32 public abstract int getSublocationId();
33
37 public abstract String getName();
38
42 public abstract String getNamespaceId();
43
47 public abstract String getInstanceId();
48
52 public abstract Integer getPower();
53
57 public abstract TransmitterStatus getStatus();
58
59 private static final class CppProxy extends Eddystone
60 {
61 private final long nativeRef;
62 private final AtomicBoolean destroyed = new AtomicBoolean(false);
63
64 private CppProxy(long nativeRef)
65 {
66 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
67 this.nativeRef = nativeRef;
68 }
69
70 private native void nativeDestroy(long nativeRef);
71 public void _djinni_private_destroy()
72 {
73 boolean destroyed = this.destroyed.getAndSet(true);
74 if (!destroyed) nativeDestroy(this.nativeRef);
75 }
76 protected void finalize() throws java.lang.Throwable
77 {
78 _djinni_private_destroy();
79 super.finalize();
80 }
81
82 // Eddystone methods
83
84 @Override
85 public Point getPoint()
86 {
87 assert !this.destroyed.get() : "trying to use a destroyed object";
88 return native_getPoint(this.nativeRef);
89 }
90 private native Point native_getPoint(long _nativeRef);
91
92 @Override
93 public int getLocationId()
94 {
95 assert !this.destroyed.get() : "trying to use a destroyed object";
96 return native_getLocationId(this.nativeRef);
97 }
98 private native int native_getLocationId(long _nativeRef);
99
100 @Override
101 public int getSublocationId()
102 {
103 assert !this.destroyed.get() : "trying to use a destroyed object";
104 return native_getSublocationId(this.nativeRef);
105 }
106 private native int native_getSublocationId(long _nativeRef);
107
108 @Override
109 public String getName()
110 {
111 assert !this.destroyed.get() : "trying to use a destroyed object";
112 return native_getName(this.nativeRef);
113 }
114 private native String native_getName(long _nativeRef);
115
116 @Override
117 public String getNamespaceId()
118 {
119 assert !this.destroyed.get() : "trying to use a destroyed object";
120 return native_getNamespaceId(this.nativeRef);
121 }
122 private native String native_getNamespaceId(long _nativeRef);
123
124 @Override
125 public String getInstanceId()
126 {
127 assert !this.destroyed.get() : "trying to use a destroyed object";
128 return native_getInstanceId(this.nativeRef);
129 }
130 private native String native_getInstanceId(long _nativeRef);
131
132 @Override
133 public Integer getPower()
134 {
135 assert !this.destroyed.get() : "trying to use a destroyed object";
136 return native_getPower(this.nativeRef);
137 }
138 private native Integer native_getPower(long _nativeRef);
139
140 @Override
141 public TransmitterStatus getStatus()
142 {
143 assert !this.destroyed.get() : "trying to use a destroyed object";
144 return native_getStatus(this.nativeRef);
145 }
146 private native TransmitterStatus native_getStatus(long _nativeRef);
147 }
148}