AirBlue Sharing API
Posted on 9 May in AirBlue Sharing
This post is also available in: Chinese (Simplified)
If you want to send files via AirBlue Sharing from your application, you have these choices:
1. OpenIn:
When you present the OpenIn menu, and the file type is supported by AirBlue Sharing, when you select AirBlue Sharing, it launches, show the device selection list and then redirect to your application. (The file will be copied from your application to AirBlue Sharing.)
2. obex://file-name-to-send
You can also use the obex:// URL scheme to, this will run AirBlue Sharing and start sending this file and redirect back to your application.
3. Through AirBlue Sharing API.
With AirBlue Sharing API, you can present the device selection window just in your application
@interface ObexPushClient : NSObject
/*
The shared instance, you can usually get this instance by:
#include
if (dlopen("/usr/lib/libblued-obex.dylib", RTLD_DEFAULT) == NULL) {
// AirBlue Sharing is not installed
return;
}
Class $ObexPushClient = objc_getClass("ObexPushClient");
id inst = [$ObexPushClient sharedClient];
*/
+ (ObexPushClient*) sharedClient;
/*
send a single file.
name: file name, readable, will be shown/saved on remote device
path: full filesystem path of the file to be sent
mime: mimetype of the file, can be specified as nil
*/
- (BOOL) sendFile:(NSString*)name atPath:(NSString*)path ofType:(NSString*)mime;
/*
deleteSend: the file will be deleted when error or sent
*/
- (BOOL) sendFile:(NSString*)name atPath:(NSString*)path ofType:(NSString*)mime deleteSent:(BOOL)yes;
/*
multiple file sending interface, prepare for sending
*/
- (void) prepareSend;
/*
multiple file sending interface, prepare for sending, delete files when error/sent
*/
- (void) prepareSendAndDelete;
/*
append a file to be sent
name: file name, readable, will be shown/saved on remote device
path: full filesystem path of the file to be sent
mime: mimetype of the file, can be specified as nil
*/
- (void) appendFile:(NSString*)name atPath:(NSString*)path ofType:(NSString*)mime;
/*
start sending now, the device select windows will show
*/
- (void) doSend;
@end
anyShare分享到: | |
|
Filed under: AirBlue Sharing
I am sending a text file to a BT printer. When I called sendFile, I can see the popup of the device list. But when I select the printer, it gets stuck, no printing. If I print it from AirBlue sharing software itself, it is totally fine. So I am sure there is something wrong with my calling API. Here is my code.
BOOL b = [inst sendFile:@"test.txt" atPath:@"/var/tmp" ofType:@"text/X-xcode"];
Is there something wrong? Please help.
Forgot to say, the return value of sendFile is true.