Am Dienstag, 5. Juni 2007 14:19 schrieben Sie:
first thanks for your quick and comprehensive help.
> If you need simple OPUSH instead of FTP use obexftp_connect_push instead
> of obexftp_connect (the channel will be selected accordingly).
please see in the attachment what i had done. The problem i encounter is that 
the phone try to pair the devices. Please review my modified c_example.c and 
get me hint.
>
> Have fun, perhaps post your solution for review and inclusion in the wiki!
please, possibly some other poeple has the same problem to solve.

Thanks again
Daniel
#include <stdio.h>
#include <stdlib.h>

#include <obexftp/client.h> /*!!!*/

int main(int argc, char *argv[])
{
        char *device;
        int channel;
        char *filename = NULL;
        obexftp_client_t *cli = NULL; /*!!!*/
        int ret;

        /* Get device, channel and optional filename */
        if (argc < 3) {
                fprintf(stderr, "Usage: %s <bt_addr> <channel> [<filename>]\n", argv[0]);
                exit(1);
        }
        device = argv[1];
        channel = atoi(argv[2]);
        if (argc > 3) {
                filename = argv[3];
        }

        /* Open connection */
        cli = obexftp_open(OBEX_TRANS_BLUETOOTH, NULL, NULL, NULL); /*!!!*/
        if (cli == NULL) {
                fprintf(stderr, "Error opening obexftp-client\n");
                exit(1);
        }

        /* Connect to client */
        ret = obexftp_connect_push(cli, device, channel); /*!!!*/
        if (ret < 0) {
                fprintf(stderr, "Error connecting via push to obexftp-client\n");
                obexftp_close(cli);
                cli = NULL;
                exit(1);
        }

        /* send file */
        ret = obexftp_put_file(cli, filename, device); /*!!!*/
		//printf("Error: %u\n", ret);

        if (ret < 0) {
				fprintf(stderr, "Error putting file\n");
        } else {
                printf("%s\n", cli->buf_data); /*!!!*/
        }

        /* Disconnect */
        ret = obexftp_disconnect(cli); /*!!!*/
        if (ret < 0) {
                fprintf(stderr, "Error disconnecting the client\n");
        }

        /* Close */
        obexftp_close(cli); /*!!!*/
        cli = NULL;

        exit(0);
} 

Attachment: pgpSgetVZT9VD.pgp
Description: PGP signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Openobex-users mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to