我尝试在蓝牙热敏打印机上打印"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
发布于 2015-11-18 00:47:14
尝试将字符串转换为十六进制值。请参考这个问题,How do I write <1100> or <2200> to the value of a characteristic on my CBPeripheral?。
如果这还不能解决它,那么你将不得不等待有此打印机经验的人出现,或者发布一些关于如何与它通信的更多信息。
https://stackoverflow.com/questions/33760076
复制相似问题