首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >蓝牙热敏打印机

蓝牙热敏打印机
EN

Stack Overflow用户
提问于 2015-11-17 22:57:37
回答 1查看 599关注 0票数 0

我尝试在蓝牙热敏打印机上打印"teststring“。制造商没有用于连接打印机的IOS SDK。我使用了SCPCoreBluetoothManager。我不知道正确的CBUUID,因为我这样做:

代码语言:javascript
复制
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];

        CBService *service = [_connectedPeripheral services][indexPath.row];

        NSString* str = @"teststring";
        NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding];

        CBMutableCharacteristic *ch = [[CBMutableCharacteristic alloc] initWithType:[service UUID] properties:CBCharacteristicPropertyWriteWithoutResponse value:nil permissions:CBAttributePermissionsWriteable];

        [_connectedPeripheral writeValue:data forCharacteristic:ch type:CBCharacteristicWriteWithResponse];

        [[cell textLabel] setText:[NSString stringWithFormat:@"%@", [service UUID]]];

        return cell;
    }

但打印机无法打印(打印机手册: yadi.sk/i/gdQQI3DOkX9fR

EN

回答 1

Stack Overflow用户

发布于 2015-11-18 00:47:14

尝试将字符串转换为十六进制值。请参考这个问题,How do I write <1100> or <2200> to the value of a characteristic on my CBPeripheral?

如果这还不能解决它,那么你将不得不等待有此打印机经验的人出现,或者发布一些关于如何与它通信的更多信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33760076

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档