我尝试打印" teststring"在蓝牙热敏打印机上。制造商没有用于连接打印机的IOS SDK。我使用了SCPCoreBluetoothManager。我不知道正确的CBUUID,因为我这样做:
- (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
答案 0 :(得分:0)
尝试将字符串转换为十六进制值。请参阅此问题How do I write <1100> or <2200> to the value of a characteristic on my CBPeripheral?。
如果没有解决问题,那么您将不得不等待有此打印机经验的人员出现或发布有关如何与之通信的更多信息。