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