You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Socket Mobile is a leading innovator of data capture and delivery solutions for enhanced productivity.
4
4
@@ -22,6 +22,36 @@ More documentation can be found [here in our CaptureSDK Documentation](https://d
22
22
23
23
**- Write some code to fit the Bluetooth discovery flow to your application's design by creating an UI that starts and shows discovered devices and select them to be paired to your application.**
24
24
25
+
We also have deprecated some CaptureHelper methods to avoid confusion and got rid of the `Device Manager`.
26
+
27
+
Here's the changes in a nutshell:
28
+
29
+
- The protocol **CaptureHelperDeviceManagerDelegate** will be removed and its methods **didNotifyArrivalForDeviceManager** and **didNotifyRemovalForDeviceManager** will be removed as well.
30
+
31
+
- The protocol **CaptureHelperDeviceManagerDiscoveryDelegate** will be renamed to **CaptureHelperDiscoveryDelegate**. Its methods **didDiscoverDevice(device:deviceManager:)** and **didEndDiscoveryWithResult(result:deviceManager:)** will be renamed to **didDiscoverDevice(device:)** and **didEndDiscoveryWithResult(result:)** respectively.
32
+
33
+
- The class **CaptureHelperDeviceManager** will be removed. You can use its methods directly from **CaptureHelper**. For instance:
34
+
35
+
```swift
36
+
bleDeviceManager.connectToDiscoveredDevice(device) { result in
/// You can use a CaptureHelper variable instead of the singleton instance as well.
47
+
```
48
+
49
+
- The **CaptureHelperDeviceManager** methods **setFavoriteDevices(favorites:)**, **getFavoriteDevicesWithCompletionHandler** will be removed. No favorites management is needed anymore in CaptureSDK 2.0.
50
+
51
+
- The **CaptureHelperDeviceManager** method **startDiscoveryWithTimeout(timeout:)** is replaced by **addBluetoothDevice(bluetoothDiscoveryMode:)** in the main **CaptureHelper** class.
52
+
53
+
- The **CaptureHelperDeviceManager** methods **getDeviceUniqueIdentifierFromDeviceGuid(deviceGuid:)**, **connectToDiscoveredDevice(device:)**, **disconnectFromDiscoveredDevice(device:)** are moved to the main **CaptureHelper** class.
54
+
25
55
[See our Getting Started section in our documentation](https://docs.socketmobile.dev/capture/ios/en/latest/gettingStarted.html)
26
56
27
57
## Devices compatibility and CaptureSDK versions
@@ -146,7 +176,6 @@ scanner.setTrigger(.start, withCompletionHandler: { result, propertyObject in
146
176
147
177
DispatchQueue.main.async {
148
178
iflet anObject = propertyObject?.object, let dic = anObject as? [String:Any], let objectType = dic["SKTObjectType"] as?String, objectType =="SKTSocketCamViewControllerType", let socketCamViewController = dic["SKTSocketCamViewController"] as? UIViewController {
149
-
150
179
////
151
180
// Present the socketCamViewController in a popover or a subview or in full screen
152
181
////
@@ -226,123 +255,14 @@ Once `CaptureSDK` is open, then the device arrival notification can occurs as so
226
255
227
256
The decoded data coming from the scanner can be retrieved by overriding the `onDecodedData` delegate.
228
257
229
-
### 4. Summary for integrating `CaptureSDK` in a Xcode project
230
-
231
-
Example of ViewController.m for SingleEntry app:
232
-
233
-
```swift
234
-
importUIKit
235
-
importCaptureSDK
236
-
237
-
classMasterViewController:
238
-
UITableViewController,
239
-
CaptureHelperDevicePresenceDelegate,
240
-
CaptureHelperDeviceManagerPresenceDelegate,
241
-
CaptureHelperDeviceDecodedDataDelegate,
242
-
CaptureHelperErrorDelegate,
243
-
CaptureHelperDevicePowerDelegate {
244
-
245
-
246
-
// Capture Helper shareInstance allows to share
247
-
// the same instance of Capture Helper with the
248
-
// entire application. That static property can
249
-
// be used in any views but it is recommended
250
-
// to open only once Capture Helper (in the main
251
-
// view controller) and pushDelegate, popDelegate
252
-
// each time a new view requiring scanning capability
253
-
// is loaded or unloaded respectively.
254
-
var captureHelper = CaptureHelper.sharedInstance
255
-
256
-
overridefuncviewDidLoad() {
257
-
super.viewDidLoad()
258
-
// Do any additional setup after loading the view, typically from a nib.
259
-
// fill out the App Info with the Bundle ID which should start by the
260
-
// platform on which the application is running and followed with the
261
-
// case sensitive application Bundle ID,
262
-
// with the Socket Mobile Portal developer ID
263
-
// and with the Application Key generated from the Socket Mobile Developer
// there is a stack of delegates the last push is the
271
-
// delegate active, when a new view requiring notifications from the
272
-
// scanner, then push its delegate and pop its delegate when the
273
-
// view is done
274
-
captureHelper.pushDelegate(self)
275
-
276
-
// to make all the delegates able to update the UI without the app
277
-
// having to dispatch the UI update code, set the dispatchQueue
278
-
// property to the DispatchQueue.main
279
-
captureHelper.dispatchQueue= DispatchQueue.main
280
-
281
-
// open Capture Helper only once in the application
282
-
captureHelper.openWithAppInfo(AppInfo, withCompletionHandler: { (_ result: SKTResult) in
283
-
print("Result of Capture initialization: \(result.rawValue)")
284
-
})
285
-
}
286
-
}
287
-
```
288
-
289
-
`CaptureHelper` makes the application aware of a new device connection by invoking the `onDeviceArrival` of the protocol and, in the same way when a device disconnects, the `onDeviceRemoval` is invoked. A `CaptureHelper` device instance representing the device that is connected can be used to retrieve or set a device property.
290
-
291
-
Example of the view controller being aware of the scanner:
For a combo device like the S370 which has 2 devices, there will be two ``didNotifyArrivalForDevice`` and two ``didNotifyRemovalForDevice`` notifications.
304
-
305
-
The following code shows how you can distinghuish and handle them:
let string = decodedData?.stringFromDecodedData()!
330
-
print("Decoded Data \(String(describing: string))")
331
-
}
332
-
}
333
-
```
334
-
335
-
The application can retrieve or modify the device properties by calling the various `CaptureHelperDevice` get/set methods. By example there is a method to retrieve the device friendly name: `getFriendlyNameWithCompletionHandler`. The call is asynchronous and will return immediately. The final result and the friendly name can be retrieved in the
336
-
completion handler function block.
337
-
338
258
**IMPORTANT**:
339
259
If a property is not accessible through the available `CaptureHelper` methods, it is very easy to add new ones, by creating a `CaptureHelper`**extension** class and copy and paste a similar get/set method and change the property settings inside the new method.
340
260
341
261
Creating a `CaptureHelper` extension allows to avoid an overwrite of a modified version of `CaptureHelper` when updating to a more recent `CaptureSDK` CocoaPods.
342
262
343
-
## Sample code
263
+
### 4. Sample code
344
264
345
-
Sample code can be found in [GitHub / SocketMobile](https://github.com/SocketMobile"Socket Mobile Samples")
265
+
Try out our sample [our Single Entry app on Github SocketMobile](https://github.com/SocketMobile/capturesingleentryswift-ios)
0 commit comments