@@ -91,26 +91,30 @@ 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.8.1
95- Publish: 2023 -11-16
94+ OrbbecSDK:v1.10.3
95+ Publish: 2024 -11-08
9696Support device list (firmware version):
9797| SDK version | Product | Firmware version |
9898| --- | --- | --- |
99- | v1.8.1 | Gemini 2 XL | Obox: V1.2.5 VL:1.4.54 |
100- | | Astra 2 | 2.8.20 |
101- | | Gemini 2 L | 1.4.32 |
102- | | Gemini 2 | 1.4.60 /1.4.76 |
103- | | Astra+ | 1.0.22/1.0.21/1.0.20/1.0.19 |
104- | | Femto | 1.6.7 |
105- | | Femto W | 1.1.8 |
106- | | DaBai | 2436 |
107- | | DaBai DCW | 2460 |
108- | | DaBai DW | 2606 |
109- | | Astra Mini Pro | 1007 |
110- | | Gemini E | 3460 |
111- | | Gemini E Lite | 3606 |
112- | | Gemini | 3.0.18 |
113- | | Astra Mini S Pro | 1.0.05 |
99+ | v1.10.3 | Gemini 335 | 1.2.20 |
100+ | | Gemini 335L | 1.2.20 |
101+ | | Gemini 336 | 1.2.20 |
102+ | | Gemini 336L | 1.2.20 |
103+ | | Gemini 2 XL | Obox: V1.2.5 VL:1.4.54 |
104+ | | Astra 2 | 2.8.20 |
105+ | | Gemini 2 L | 1.4.32 |
106+ | | Gemini 2 | 1.4.60 /1.4.76 |
107+ | | Astra+ | 1.0.22/1.0.21/1.0.20/1.0.19 |
108+ | | Femto | 1.6.7 |
109+ | | Femto W | 1.1.8 |
110+ | | DaBai | 2436 |
111+ | | DaBai DCW | 2460 |
112+ | | DaBai DW | 2606 |
113+ | | Astra Mini Pro | 1007 |
114+ | | Gemini E | 3460 |
115+ | | Gemini E Lite | 3606 |
116+ | | Gemini | 3.0.18 |
117+ | | Astra Mini S Pro | 1.0.05 |
114118
115119# Simple code of open depth stream
116120Create OBContext global member to manager attach devices
@@ -127,52 +131,38 @@ Initialize OBContext with DeviceChangedCallback
127131mOBContext = new OBContext (getApplicationContext(), new DeviceChangedCallback () {
128132 @Override
129133 public void onDeviceAttach (DeviceList deviceList ) {
130- synchronized (mCurrentDeviceLock) {
131- if (null == mCurrentDevice) {
132- // DeviceList#getDevice(index) can only call once inside onDeviceAttach()
133- mCurrentDevice = deviceList. getDevice(0 );
134- mCurrentDeviceInfo = mCurrentDevice. getInfo();
135- Log . d(" Orbbec" , " Device connection. name: " + mCurrentDeviceInfo. getName() + " , uid: " + mCurrentDeviceInfo. getUid());
136- }
137- }
138- try {
134+ try {
135+ mDevice = deviceList. getDevice(0 );
139136 deviceList. close();
140- } catch (Exception e) {
137+ // do something
138+ mDevice. close();
139+ } catch (Exception e) {
141140 e. printStackTrace();
142- }
141+ }
143142 }
144143
145144 @Override
146145 public void onDeviceDetach (DeviceList deviceList ) {
147146 try {
148- int deviceCount = deviceList. getDeviceCount();
149- for (int i = 0 ; i < deviceCount; i++ ) {
150- String uid = deviceList. getUid();
151- if (null != mCurrentDevice) {
152- synchronized (mCurrentDeviceLock) {
153- if (null != mCurrentDeviceInfo && mCurrentDeviceInfo. getUid(). equals(uid)) {
154- // handle device disconnection
155- // do something
156-
157- Log . d(" Orbbec" , " Device disconnection. name: " + mCurrentDeviceInfo. getName() + " , uid: " + mCurrentDeviceInfo. getUid());
158- mCurrentDevice. close();
159- mCurrentDevice = null ;
160-
161- mCurrentDeviceInfo. close();
162- mCurrentDeviceInfo null ;
163- }
164- } // synchronized
165- }
166- } // for
147+ if (null != mCurrentDevice){
148+ int deviceCount= deviceList. getDeviceCount();
149+ for (int i= 0 ;i< deviceCount; i++ ){
150+ String uid= deviceList. getUid();
151+ if (null != mCurrentDeviceInfo&& mCurrentDeviceInfo. getUid(). equals(uid)){
152+ // handle device disconnection
153+ // do something
154+
155+ Log . d(" Orbbec" ," Device disconnection. name: " + mCurrentDeviceInfo. getName()+ " , uid: " + mCurrentDeviceInfo. getUid());
156+ mCurrentDevice. close();
157+ mCurrentDevice= null ;
158+ }
159+ }
160+ }
167161 } catch (Exception e) {
168162 e. printStackTrace();
169- }
170-
171- try {
163+ } finally {
172164 deviceList. close();
173- } catch (Exception e) {
174- e. printStackTrace();
175- }
165+ }
176166 }
177167});
178168```
0 commit comments