/*
 * libsyncml - A syncml protocol implementation
 * Copyright (C) 2005  Armin Bauer <armin.bauer@opensync.org>
 * Copyright (C) 2008  Michael Bell <michael.bell@opensync.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 */

#ifndef _OBEX_CLIENT_INTERNALS_H_
#define _OBEX_CLIENT_INTERNALS_H_

#include "obex_bluetooth.h"
#include <openobex/obex.h>

#ifndef WIN32
#include <termios.h>
#include <sys/ioctl.h>
#endif

#define STREAM_CHUNK 4096

typedef enum {
	SML_OBEX_VENDOR_UNKNOWN = 0,
	SML_OBEX_VENDOR_SAMSUNG = 1,
} SmlTransportObexVendorType;

typedef enum {
	SML_TRANSPORT_OBEX_DATASTORE_UNKNOWN = 0,
	SML_TRANSPORT_OBEX_DATASTORE_CONTACT = 1,
	SML_TRANSPORT_OBEX_DATASTORE_EVENT = 2,
	SML_TRANSPORT_OBEX_DATASTORE_NOTE = 3,
	SML_TRANSPORT_OBEX_DATASTORE_TODO = 4,
} SmlTransportObexDatastoreType;

typedef struct SmlTransportObexClientEnv {
	SmlTransportConnectionType type;
	SmlTransport *tsp;
	obex_t *obexhandle;
	uint32_t connection_id;
	char *path;
	unsigned int port;
	char *irda_service;
	char *at_command;
	char *manufacturer;
	char *model;
	GList *datastores;

	int fd;
	int state;
	char *databuf;
	int *databuflen;
	int connected;
#ifndef WIN32
	struct termios oldtio;
#endif
	SmlBool busy;
	SmlBool error;
	SmlMimeType mimetype;
	SmlBool isDisconnected;
} SmlTransportObexClientEnv;

SmlBool smlTransportObexClientNew(SmlTransport *tsp, SmlError **error);

#endif //_OBEX_CLIENT_INTERNALS_H_
