Skip to contentSkip to conversation

Add transport format member in fdobex_data struct.

PATCH Superseded Nami 1 participant 3 messages Jun 21, 2011

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Nami

author
#0 lore raw

PATCH v2 1/3 Add transport format member in fdobex_data struct.

---
 include/openobex/obex_const.h |    5 +++++
 lib/fdobex.c                  |    1 +
 lib/fdobex.h                  |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)
include/openobex/obex_const.h +5 -0
index cb7afeb..700bacb 100644
@@ -302,6 +302,11 @@ enum obex_rsp_mode {
   OBEX_RSP_MODE_SINGLE = 1, /**< single response mode (SRM) */
 };
 
+enum fdobex_transport_format {
+  FDOBEX_MT_STREAM    = 0, /**< stream transport format */
+  FDOBEX_MT_SEQPACKET = 1, /**< seqpacket transport format */
+};
+
 /* Min, Max and default transport MTU */
 #define OBEX_DEFAULT_MTU	1024
 #define OBEX_MINIMUM_MTU	255
lib/fdobex.c +1 -0
index 45c56ff..7fa4a21 100644
@@ -14,6 +14,7 @@
 static int fdobex_init(obex_t *self)
 {
 	self->trans.data.fd.writefd = INVALID_SOCKET;
+	self->trans.data.fd.fmt = FDOBEX_MT_STREAM;
 
 	return 0;
 }
lib/fdobex.h +1 -0
index 07e33ab..01741c8 100644
@@ -6,5 +6,6 @@ void fdobex_get_ops(struct obex_transport_ops* ops);
 
 struct fdobex_data {
 	socket_t writefd; /* write descriptor */
+	enum fdobex_transport_format fmt;  /* transport format */
 };
 #endif

--
1.7.1

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Openobex-users mailing list [email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users

author
#1 lore raw

PATCH v2 2/3 Create new API to set fd obex transport format.

---
 include/openobex/obex.h |    1 +
 lib/obex.c              |   16 ++++++++++++++++
 lib/obex.sym            |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)
include/openobex/obex.h +1 -0
index f948113..cb1d66a 100644
@@ -148,6 +148,7 @@ OPENOBEX_SYMBOL(int) BtOBEX_TransportConnect(obex_t *self, bt_addr_t *src, bt_ad
  * OBEX File API
  */
 OPENOBEX_SYMBOL(int) FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu);
+OPENOBEX_SYMBOL(void)FdOBEX_SetTransportFormat(obex_t *self, enum fdobex_transport_format fmt);
 
 /*
  * OBEX interface discovery API
lib/obex.c +16 -0
index 165fcb8..33d2e4e 100644
@@ -1136,6 +1136,22 @@ int CALLAPI FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu)
 }
 
 /**
+	FdOBEX_SetTransportFormat - set transport format for OBEX_TRANS_FD transport.
+
+	\param self OBEX handle
+	\param fmt transport format: 0 - default
+ */
+LIB_SYMBOL
+void FdOBEX_SetTransportFormat(obex_t *self, enum fdobex_transport_format fmt)
+{
+	DEBUG(4, "\n");
+
+	obex_return_val_if_fail(self != NULL, -1);
+
+	self->trans.data.fd.fmt = fmt;
+}
+
+/**
 	Connect USB interface.
 	\param self OBEX handle
 	\param intf USB interface to connect to
lib/obex.sym +1 -0
index 0c33b63..0f59042 100644
@@ -39,6 +39,7 @@ IrOBEX_TransportConnect
 BtOBEX_ServerRegister
 BtOBEX_TransportConnect
 FdOBEX_TransportSetup
+FdOBEX_SetTransportFormat
 OBEX_InterfaceConnect
 OBEX_EnumerateInterfaces
 OBEX_GetInterfaceByIndex

--
1.7.1

author
#2 lore raw

PATCH v3 3/3 Modify code to read entire packet when fd transport format is SEQPACKET.

In reply to Nami
---
 lib/fdobex.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
lib/fdobex.c +3 -0
index 7fa4a21..46a0796 100644
@@ -79,6 +79,9 @@ static int fdobex_read(obex_t *self, void *buf, int buflen)
 {
 	struct obex_transport *trans = &self->trans;
 
+	if(trans->data.fd.fmt == FDOBEX_MT_SEQPACKET)
+		buflen = self->mtu_rx;
+
 #ifdef _WIN32
 	return  _read(trans->fd, buf, buflen);
 #else

--
1.7.1

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Openobex-users mailing list [email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users