1

我已经想出了如何使用 ScanAPI 启用 i2of5,但它似乎没有更新与 i2of5 条形码类型关联的长度参数的明确示例。

我使用以下内容“启用” i2of5 ...

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

ScanAPI 参考

我想将长度参数(L1)设置为10。使用指定可以传入的数组的文档信息。我想知道的是使用什么API调用来传递这个参数数组?

这是我尝试过的,将长度设置为 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:)];

我可以使用 Socket Mobile 命令条形码文档中的条形码轻松配置它,但我想在我们的 Android 和 iOS 应用程序中自动执行此操作。现在(显然)在 iOS 中工作。

4

1 回答 1

1

你非常亲近。设备特定是配置长度的正确属性

如果您按如下方式更改两行,它应该可以工作

// 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:)];

编辑

正如您正确指出的那样,postSetDeviceSpecific不存在。您需要将以下内容添加到您的副本中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

}
于 2016-08-23T16:42:46.667 回答