@@ -91,8 +91,8 @@ targetSdk 27
9191** targetSdkVersion** 27 to fixed bug 'Android 10 Devices Do NOT Support USB Camera Connection' which fixed on android 11.
9292
9393# Support orbbec device
94- OrbbecSDK:v1.6.3
95- Publish: 2023-06-31
94+ OrbbecSDK:v1.8.1
95+ Publish: 2023-11-16
9696Support device list (firmware version):
9797| Class| Product| Firmware|
9898| -| -| -|
@@ -103,6 +103,7 @@ Support device list (firmware version):
103103|| Astra2| V2.8.20|
104104|| Gemini2| V1.4.60|
105105|| Gemini2L| V1.4.32|
106+ || Gemini2XL| Obox: V2.0.1 VL:1.4.56|
106107| OpenNI| Gemini||
107108|| Dabai DW||
108109|| Dabai DCW||
@@ -119,6 +120,118 @@ Support device list (firmware version):
119120|| Gemini E||
120121|| Gemini E Lite||
121122
123+ # Quick Start
124+ Create OBContext global member to manager attach devices
125+ ``` java
126+ // Application hold only one OBContext instance.
127+ private OBContext mOBContext;
128+ private Object mCurrentDeviceLock = new Object ();
129+ private Device mCurrentDevice;
130+ private DeviceInfo mCurrentDeviceInfo;
131+ ```
132+
133+ Initialize OBContext with DeviceChangedCallback
134+ ``` java
135+ mOBContext = new OBContext (getApplicationContext(), new DeviceChangedCallback () {
136+ @Override
137+ public void onDeviceAttach (DeviceList deviceList ) {
138+ synchronized (mCurrentDeviceLock) {
139+ if (null == mCurrentDevice) {
140+ // DeviceList#getDevice(index) can only call once inside onDeviceAttach()
141+ mCurrentDevice = deviceList. getDevice(0 );
142+ mCurrentDeviceInfo = mCurrentDevice. getInfo();
143+ Log . d(" Orbbec" , " Device connection. name: " + mCurrentDeviceInfo. getName() + " , uid: " + mCurrentDeviceInfo. getUid());
144+ }
145+ }
146+ try {
147+ deviceList. close();
148+ } catch (Exception e) {
149+ e. printStackTrace();
150+ }
151+ }
152+
153+ @Override
154+ public void onDeviceDetach (DeviceList deviceList ) {
155+ try {
156+ int deviceCount = deviceList. getDeviceCount();
157+ for (int i = 0 ; i < deviceCount; i++ ) {
158+ String uid = deviceList. getUid();
159+ if (null != mCurrentDevice) {
160+ synchronized (mCurrentDeviceLock) {
161+ if (null != mCurrentDeviceInfo && mCurrentDeviceInfo. getUid(). equals(uid)) {
162+ // handle device disconnection
163+ // do something
164+
165+ Log . d(" Orbbec" , " Device disconnection. name: " + mCurrentDeviceInfo. getName() + " , uid: " + mCurrentDeviceInfo. getUid());
166+ mCurrentDevice. close();
167+ mCurrentDevice = null ;
168+
169+ mCurrentDeviceInfo. close();
170+ mCurrentDeviceInfo null ;
171+ }
172+ } // synchronized
173+ }
174+ } // for
175+ } catch (Exception e) {
176+ e. printStackTrace();
177+ }
178+
179+ try {
180+ deviceList. close();
181+ } catch (Exception e) {
182+ e. printStackTrace();
183+ }
184+ }
185+ });
186+ ```
187+
188+ Define Pipeline and Device
189+ ``` java
190+ private Pipeline mPipeline;
191+ ```
192+
193+ Start Depth stream
194+ ``` java
195+ try {
196+ mPipeline = new Pipeline (mCurrentDevice);
197+ StreamProfileList depthProfileList = mPipeline. getStreamProfileList(SensorType . DEPTH );
198+ StreamProfile streamProfile = depthProfileList. getStreamProfile(0 );
199+ if (null != depthProfileList) {
200+ depthProfileList. close();
201+ return ;
202+ }
203+
204+ Config config = new Config ();
205+ mPipeline. start(config, new FrameSetCallback () {
206+ public void onFrameSet (FrameSet frameSet ) {
207+ DepthFrame depthFrame = frameSet. getDepthFrame()
208+ if (null != depthFrame) {
209+ Log . d(" Orbbec" , " onFrameSet depthFrame index: " + depthFrame. getFrameIndex() + " , timeStamp: " + depthFrame. getTimeStamp());
210+
211+ // do Render
212+
213+ depthFrame. close();
214+ }
215+ }
216+ });
217+ config. close();
218+ } catch (OBException e) {
219+ e. printStackTrace();
220+ }
221+ ```
222+
223+ Stop stream
224+ ``` java
225+ try {
226+ mPipeline. stop();
227+ mPipeline. close();
228+ mPipeline = null ;
229+ } catch (OBException e) {
230+ e. printStackTrace();
231+ }
232+ ```
233+
234+
122235
123236# QA
124237## LintModelSeverity has been compiled by a more recent version of the Java
0 commit comments