Cognex Mobile Barcode SDK
SDK for supporting communication with Cognex Barcode Reader devices
Cognex Mobile Barcode iOS SDK


The CMB SDK can be used to connect to Cognex Barcode readers and perform operations on these systems. You can retrieve read results, images, image graphics and read statistics. The SDK also allows you to configure your system or change individual settings. Refer to the DMCC Command Reference document for a complete list of DMCC commands that you can send to a Cognex system.

The SDK package contains a sample application that shows you the basic concepts and how to use the SDK.

Quick Start

The CMB SDK comprises the iOS SDK lib files and their documentation. The library files are available for iOS 10.1.

Using the DataMan SDK library

To use the DataMan SDK for an iOS project, you will need to add the following files to your XCode project:

  • libDataManSDK.a
  • /include/CDMDataManSystem.h
  • /include/CDMDataManSystemDelegate.h
  • /include/CDMResponse.h
  • /include/CDMEADiscoverer.h
  • /include/CNMEthernetSystemDiscoverer.h
  • /include/CNMSystemDiscoveredDelegate.h
  • /include/CNMCogNamerDevice.h
  • /include/CNMCogNamerDeviceType.h
  • /include/DataManSDK.h

After adding the files, make sure, that the libDataManSDK.a file is present in the Project Settings > Build Phases > Link Binary With Libraries section.

Creating and Initializing CDMDataManSystem

First of all use the following header file to access the DataMan SDK classes:

#import "DataManSDK.h"

For communication with each DataMan device, you will need to create a CDMDataManSystem object. Here is a sample code showing how to connect to a device using its IP address.

CDMDataManSystem *dataManSystem;
dataManSystem = [CDMDataManSystem dataManSystemWithHostname:@"" withPort:23 withDelegate:self];

To connect to an External Accessory device, like the MX-1000, you will need to include the DataMan External Accessory Protocol identifier in the Info.plist of your project:


Then you can enumerate the available connected devices with:

NSArray* connectedAccessories = [[CDMEADiscoverer sharedDiscoverer] compatibleAccessories];

To initialize CDMDataManSystem object for a connected device:

CDMDataManSystem *dataManSystem;
if (connectedAccessories.count > 0)
dataManSystem = [CDMDataManSystem dataManSystemWithAccessory:connectedAccessories[0] delegate:self];

Next, the result types needs to be specified:

To connect, the connect method will be called:

[dataManSystem connect];

To send commands to the device and retrieve their responses through the DataMan SDK, you can use the sendCommand method:

[self.dataManSystem sendCommand:@"TRIGGER ON" withCallback:^(CDMResponse *response){
if (response.status == DMCC_STATUS_NO_ERROR) {
// command has succeed.
} else {
// handle error
[self.dataManSystem sendCommand:@"GET TRAINED-CODE.INFO" withCallback:^(CDMResponse *response){
if (response.status == DMCC_STATUS_NO_ERROR) {
if ([response.payload isEqualToString:@"Untrained"]) {
// device is untrained
} else {
// device is trained

Receiving messages from a CDMDataManSystem

To receive messages from a DataMan system, you will need to implement the CDMDataManSystemDelegate protocol and pass the class as a delegate when initializing the DataMan system. Here is a skeleton implementation of the delegate methods. Note that only the first four methods are required, the rest are optional methods.

- (void)dataManSystemDidConnect:(CDMDataManSystem *)dataManSystem
NSLog(@"CDMAppDelegate dataManSystemDidConnect");
- (void)dataManSystemDidDisconnect:(CDMDataManSystem *)dataManSystem withError:(NSError *)error
NSLog(@"dataManSystemDidDisconnect with error: %@", [error description]);
- (void)dataManSystemDidMissHeartbeatResponse:(CDMDataManSystem *)dataManSystem
- (void)dataManSystem:(CDMDataManSystem *)dataManSystem didReceiveReadString:(NSString *)readString withId:(int)resultId
NSLog(@"didReceiveReadString:%@ withId: %d", readString, resultId);
- (void)dataManSystem:(CDMDataManSystem *)dataManSystem didReceiveImage:(UIImage *)image withId:(int)resultId