SocketMobile.Capture 1.0.513.13

There is a newer version of this package available.
See the version list below for details.
dotnet add package SocketMobile.Capture --version 1.0.513.13
NuGet\Install-Package SocketMobile.Capture -Version 1.0.513.13
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SocketMobile.Capture" Version="1.0.513.13" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SocketMobile.Capture --version 1.0.513.13
#r "nuget: SocketMobile.Capture, 1.0.513.13"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SocketMobile.Capture as a Cake Addin
#addin nuget:?package=SocketMobile.Capture&version=1.0.513.13

// Install SocketMobile.Capture as a Cake Tool
#tool nuget:?package=SocketMobile.Capture&version=1.0.513.13

Capture SDK Version 1.0.513

Socket Mobile is a leading innovator of data capture and delivery solutions for enhanced productivity.

Capture SDK is the easiest solution for adding barcode scanning capability to a Windows application.

The Socket Mobile barcode scanner is an ergonomic, fast and accurate solution to a variety of data entry scenarios.

This SDK is very easy to integrate to an application without any requirement to follow a specific design architecture.

Integration into an application can be done in as little as 10 minutes!

More documentation can be found here.

Table of Contents

  • Quick install notes
  • Capture usage
  • Sample code
  • Configure and connect a Socket Mobile device

Quick install notes

The Capture SDK is available as NuGet package.

To install the SDK in an application, open the Manage NuGet Packages for Solution accessible through the Visual Studio Tools menu by selecting NuGet Package Manager.

A dialog displays a list of various NuGet sources. Make sure the Package source is set to either All or nuget.org. In the search box type SocketMobile.Capture to list the Socket Mobile Capture NuGet. Make sure to select SocketMobile.Capture.

An AppKey is required in order to use Capture SDK and can be generated by registering your application on Socket Mobile developer portal.

Our sample applications do not require any registration, they include a default AppKey.

IMPORTANT: Capture relies on the Socket Mobile Companion which is a service running in background. The Socket Mobile Companion can be downloaded here.

The Socket Mobile Companion requires at least ONE BLUETOOTH INBOUND port that is prompted during its installation.

Capture usage

The Capture API is described in detail in the documentation.

The recommended way of using Capture is to use CaptureHelper.cs.

1 getting a CaptureHelper instance

CaptureHelper can be instantiated by doing a simple new allocation and the reference can be kept in a field of an object where Capture is needed.

2 CaptureHelper events subscription

An application can subscribe for various events but at minimum it should subcribe to the decoded data event in order to receive the decoded data read by the Socket Mobile device.

Other events such as the device arrival and device removal can be used to track the presence of a Socket Mobile device.

The terminate event can be used in order to track when Capture has been completely shutdown or when the Socket Mobile Companion service has been terminated.

3 Opening CaptureHelper

The API for starting Capture is the OpenAsync method that needs to be invoked with the application information retrieved from the Socket Mobile developer portal, after registering the application.

Once Capture is open, then the device arrival notification can occurs as soon as a scanner is connected to the Windows host.

Summary for integrating Capture in a Windows project is a simple 4 step process:

  1. Add SocketMobile.Capture NuGet into the application solution by selecting Package Manager for solution in the Tools menu NuGet Package Manager.

  2. Add using SocketMobile.Capture; in your application in the source where CaptureHelper should be instantiated.

  3. Subscribe for the Capture events the application is interested in.

  4. Initialize CaptureHelper by calling CaptureHelper OpenAsync method with the application information to start using Capture.

//1- add the SocketMobile Capture namespace
using SocketMobile.Capture;

public partial class Form1 : Form
{
    //2- Create a CaptureHelper member
    CaptureHelper mCapture;
    public Form1()
    {
        InitializeComponent();
        // 3- instantiate and configure CaptureHelper
        mCapture = new CaptureHelper();
        mCapture.ContextForEvents = WindowsFormsSynchronizationContext.Current;
        mCapture.DeviceArrival += mCapture_DeviceArrival;
        mCapture.DeviceRemoval += mCapture_DeviceRemoval;
        mCapture.DecodedData += mCapture_DecodedData;

        // this is to handle the case of the Socket Mobile Companion
        // being stopped for some reason
        mCapture.Terminate+= mCapture_Terminate;

        // 4- Start opening the connection to Socket Mobile Companion
        // which must be running, here it is done with a timer
        // because we restart this timer in case the Socket Mobile Companion
        // has been stopped
        timerOpenCapture.Tick += timerOpenCapture_Tick;
        timerOpenCapture.Start();
    }

    private async void timerOpenCapture_Tick(object sender, EventArgs e)
    {
        timerOpenCapture.Stop();

        long Result = await mCapture.OpenAsync("windows:com.socketmobile.singleentry",
            "BB57D8E1-F911-47BA-B510-693BE162686A",
            "MCwCFAJIzwgOK1fYEE5KdmPOe+Lm+5x6AhR6kYJKPLvEsh8TO7jaivECRe5C9A==");
        if (!SktErrors.SKTSUCCESS(Result))
        {
            labelVersion.Text = "Unable to connect to Socket Mobile Companion";
            DialogResult dialogResult = MessageBox.Show(
                "Unable to open Capture, is Socket Mobile Companion Service running?",
                "Error",
                MessageBoxButtons.RetryCancel,
                MessageBoxIcon.Warning);
            if (dialogResult == DialogResult.Retry)
            {
                timerOpenCapture.Start();
            }
            else
            {
                Close();
            }
        }
    }
}

CaptureHelper makes the application aware of a new device connection by invoking the device arrival event handler and, in the same way when a device disconnects, the device removal event handler is invoked.

A CaptureHelperDevice instance representing the device that is connected can be used to retrieve or set a device property.

If the scanner triggers a scan, the decoded data can be retrieved in the decoded data event handler.

Sample code

Sample code can be found in GitHub / SocketMobile

Configure and connect a Socket Mobile device

The Socket Mobile devices are shipped by default in Basic mode which is NOT compatible with the Capture SDK.

The device can be configured into the Application mode by using the "Help to connect" popup menu item from the Socket Mobile Companion.

You can also refer to the documentation for instructions without using Companion.

SUMMARY

For ALL user scenarios with the Socket Mobile device and any sample app or developed application with Capture support these steps MUST occur in order to be able to connect and communicate with the device:

  1. Make sure the Socket Mobile Companion is running by checking the present of the scanner icon in the tray bar.
  2. Setup the Socket Mobile device in Application mode
  3. Discover and pair the Socket Mobile device from the Bluetooth settings
  4. Verify Bluetooth connected state between Windows and the device by checking if the Socket Mobile Companion icon light up.
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
MonoAndroid monoandroid10 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.16.891 103 3/25/2024
1.5.7.434 273 2/26/2024
1.5.2.256 388 2/14/2024
1.5.0.248 104 2/14/2024
1.4.17.146 1,313 11/29/2023
1.4.8.28 501 11/11/2023
1.3.77.946 3,362 11/14/2022
1.3.10.386 1,873 10/4/2022
1.0.513.13 16,252 5/16/2019
1.0.475.552 3,966 1/4/2019
1.0.438.512 996 10/17/2018
1.0.396.477 831 10/4/2018
1.0.272.337 4,594 1/29/2018

First version of Capture SDK as NuGet