Вопрос:

Set length for i2of5 interleaved configuration

socketscan

63 просмотра

1 ответ

146 Репутация автора

I've figured out how to enable i2of5 using the ScanAPI, but it doesn't seem to have a clear example of updating the length parameter associated with the i2of5 barcode type.

I used the following to 'enable' i2of5...

[self.ScanApi postSetSymbologyInfo:_deviceInfoToTrigger SymbologyId:kSktScanSymbologyStandard2of5 Status:YES Target:self Response:@selector(onSetSymbology:)];

ScanAPI Reference

I would like to set the length parameter (L1) to 10. Using the documentation information which specifies an array that can be passed in. What I would like to know is what API call is used to pass this parameter array in?

Here's what I've tried, setting the length to 10 (0xA0):

unsigned char deviceCommand[] = { 0x09,0xC6,0x04,0x00,0xFF,0x16,0xA0,0x00,0x00 };
[self.ScanApi postGetDeviceSpecific:_deviceInfoToTrigger Command:deviceCommand Length:9 Target:self Response:@selector(onSetDeviceSpecific:)];

I am able to configure it easily with the barcodes in the Socket Mobile command barcodes document but I would like to do this automatically within our application in both Android and iOS. Working in iOS right now (obviously).

Автор: Mark Источник Размещён: 22.08.2016 09:51

Ответы (1)


1 плюс

5936 Репутация автора

Решение

You were very close. Device Specific is the correct property for configuring the length

It should work if you change your two lines as follows

// Leave the L2 parameter ID unchanged
// 10 is 0x0A not 0xA0
unsigned char deviceCommand[] = { 0x09, 0xC6, 0x04, 0x00, 0xFF, 0x16, 0x0A, 0x17, 0x00 };

// You need to set the device specific property, not get it
[self.ScanApi postSetDeviceSpecific:_deviceInfoToTrigger Command:deviceCommand Length:9 Target:self Response:@selector(onSetDeviceSpecific:)];

EDIT

As you correctly pointed out, postSetDeviceSpecific does not exist. You will need to add the following to your copy of ScanApiHelper.mm

/**
 * postSetDeviceSpecific
 *
 * post a command specific to a certain type of scanner
 * The command is usually a series of bytes that are understandable only
 * by one particular type of scanner therefore the type of scanner must be
 * checked prior calling this method
 *
 * @param deviceInfo to send the command to
 * @param pCommand pointer to the bytes to send to the device
 * @param length of the command in bytes
 * @param target main object receiving the response
 * @param response selector invoked when the response is received
 */
-(void)postSetDeviceSpecific:(DeviceInfo*)deviceInfo Command:(unsigned char*)pCommand Length:(int) length Target:(id)target Response:(SEL) response{
    ISktScanObject*scanObj=[SktClassFactory createScanObject];
    [[scanObj Property]setID:kSktScanPropIdDeviceSpecific];
    [[scanObj Property]setType:kSktScanPropTypeArray];
    [[scanObj Property]setArray:pCommand Length:length];
    CommandContext* command=[[CommandContext alloc]initWithParam:FALSE
                                                         ScanObj:scanObj
                                                      ScanDevice:[deviceInfo getSktScanDevice]
                                                          Device:deviceInfo
                                                          Target:target
                                                        Response:response];

    [self addCommand:command];
#if __has_feature(objc_arc)
#else
    [command release];
#endif

}
Автор: Enrico Размещён: 23.08.2016 04:42
Вопросы из категории :
32x32