#include <inttypes.h>
Data Structures | |
struct | bfb_frame_t |
struct | bfb_data_t |
Defines | |
#define | BFB_FRAME_CONNECT 0x02 |
#define | BFB_FRAME_INTERFACE 0x01 |
#define | BFB_FRAME_KEY 0x05 |
#define | BFB_FRAME_AT 0x06 |
#define | BFB_FRAME_EEPROM 0x14 |
#define | BFB_FRAME_DATA 0x16 |
#define | BFB_CONNECT_HELLO 0x14 |
#define | BFB_CONNECT_HELLO_ACK 0xaa |
#define | BFB_KEY_PRESS 0x06 |
#define | MAX_PACKET_DATA 32 |
#define | BFB_DATA_ACK 0x01 |
#define | BFB_DATA_FIRST 0x02 |
#define | BFB_DATA_NEXT 0x03 |
#define | bfb_write_at(fd, data) bfb_write_packets(fd, BFB_FRAME_AT, data, strlen(data)) |
#define | bfb_write_key(fd, data) bfb_write_subcmd8(fd, BFB_FRAME_KEY, BFB_KEY_PRESS, data) |
#define | bfb_send_ack(fd) bfb_send_data(fd, BFB_DATA_ACK, NULL, 0, 0) |
#define | bfb_send_first(fd, data, length) bfb_send_data(fd, BFB_DATA_FIRST, data, length, 0) |
#define | bfb_send_next(fd, data, length, seq) bfb_send_data(fd, BFB_DATA_NEXT, data, length, seq) |
Typedefs | |
typedef int | fd_t |
Functions | |
uint8_t | bfb_checksum (uint8_t *data, int len) |
Returns the whole buffer folded with xor. | |
int | bfb_write_subcmd (fd_t fd, uint8_t type, uint8_t subtype) |
Send a cmd, subcmd packet, add chk (no parameters). | |
int | bfb_write_subcmd0 (fd_t fd, uint8_t type, uint8_t subtype) |
Send a cmd, subcmd packet. | |
int | bfb_write_subcmd8 (fd_t fd, uint8_t type, uint8_t subtype, uint8_t p1) |
Send a cmd, subcmd, data packet. | |
int | bfb_write_subcmd1 (fd_t fd, uint8_t type, uint8_t subtype, uint16_t p1) |
Send a cmd, subcmd packet, add chk (one word parameter). | |
int | bfb_write_subcmd2 (fd_t fd, uint8_t type, uint8_t subtype, uint16_t p1, uint16_t p2) |
Send a cmd, subcmd packet, add chk (two word parameter). | |
int | bfb_write_subcmd3 (fd_t fd, uint8_t type, uint8_t subtype, uint16_t p1, uint16_t p2, uint16_t p3) |
Send a cmd, subcmd packet, add chk (three word parameter). | |
int | bfb_write_subcmd_lw (fd_t fd, uint8_t type, uint8_t subtype, uint32_t p1, uint16_t p2) |
Send a cmd, subcmd packet, add long, word parameter. | |
int | bfb_stuff_data (uint8_t *buffer, uint8_t type, uint8_t *data, uint16_t len, uint8_t seq) |
Stuff data frame into serial cable encapsulation. | |
int | bfb_write_packets (fd_t fd, uint8_t type, uint8_t *buffer, int length) |
Send actual packets. | |
int | bfb_send_data (fd_t fd, uint8_t type, uint8_t *data, uint16_t length, uint8_t seq) |
Stuff data into packet buffers and send all packets. | |
bfb_frame_t * | bfb_read_packets (uint8_t *buffer, int *length) |
Retrieve actual packets. | |
int | bfb_assemble_data (bfb_data_t **data, int *size, int *len, bfb_frame_t *frame) |
Append BFB frame to a data buffer. | |
int | bfb_check_data (bfb_data_t *data, int len) |
Check if data buffer is complete and valid. |
ObexFTP library - language bindings for OBEX file transfer.
Copyright (c) 2002-2007 Christian W. Zuckschwerdt <zany@triq.net>
ObexFTP 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 of the License, or (at your option) any later version.
This program 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 ObexFTP. If not, see <http://www.gnu.org/>.
#define BFB_CONNECT_HELLO 0x14 |
#define BFB_CONNECT_HELLO_ACK 0xaa |
#define BFB_DATA_ACK 0x01 |
#define BFB_DATA_FIRST 0x02 |
#define BFB_DATA_NEXT 0x03 |
#define BFB_FRAME_AT 0x06 |
#define BFB_FRAME_CONNECT 0x02 |
#define BFB_FRAME_DATA 0x16 |
#define BFB_FRAME_EEPROM 0x14 |
#define BFB_FRAME_INTERFACE 0x01 |
#define BFB_FRAME_KEY 0x05 |
#define BFB_KEY_PRESS 0x06 |
#define bfb_send_ack | ( | fd | ) | bfb_send_data(fd, BFB_DATA_ACK, NULL, 0, 0) |
#define bfb_send_first | ( | fd, | |||
data, | |||||
length | ) | bfb_send_data(fd, BFB_DATA_FIRST, data, length, 0) |
#define bfb_send_next | ( | fd, | |||
data, | |||||
length, | |||||
seq | ) | bfb_send_data(fd, BFB_DATA_NEXT, data, length, seq) |
#define bfb_write_at | ( | fd, | |||
data | ) | bfb_write_packets(fd, BFB_FRAME_AT, data, strlen(data)) |
#define bfb_write_key | ( | fd, | |||
data | ) | bfb_write_subcmd8(fd, BFB_FRAME_KEY, BFB_KEY_PRESS, data) |
#define MAX_PACKET_DATA 32 |
typedef int fd_t |
int bfb_assemble_data | ( | bfb_data_t ** | data, | |
int * | size, | |||
int * | len, | |||
bfb_frame_t * | frame | |||
) |
Append BFB frame to a data buffer.
int bfb_check_data | ( | bfb_data_t * | data, | |
int | len | |||
) |
Check if data buffer is complete and valid.
uint8_t bfb_checksum | ( | uint8_t * | data, | |
int | len | |||
) |
Returns the whole buffer folded with xor.
bfb_frame_t* bfb_read_packets | ( | uint8_t * | buffer, | |
int * | length | |||
) |
Retrieve actual packets.
int bfb_send_data | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t * | data, | |||
uint16_t | length, | |||
uint8_t | seq | |||
) |
Stuff data into packet buffers and send all packets.
int bfb_stuff_data | ( | uint8_t * | buffer, | |
uint8_t | type, | |||
uint8_t * | data, | |||
uint16_t | len, | |||
uint8_t | seq | |||
) |
Stuff data frame into serial cable encapsulation.
buffer needs to be of at leaset len+7 size Type 0x01: "prepare" command. Type 0x02: first transmission in a row. Type 0x03: continued transmission. seq needs to be incremented afterwards.
int bfb_write_packets | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t * | buffer, | |||
int | length | |||
) |
Send actual packets.
Patch from Jorge Ventura to handle EAGAIN from write.
int bfb_write_subcmd | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t | subtype | |||
) |
Send a cmd, subcmd packet, add chk (no parameters).
int bfb_write_subcmd0 | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t | subtype | |||
) |
Send a cmd, subcmd packet.
int bfb_write_subcmd1 | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t | subtype, | |||
uint16_t | p1 | |||
) |
Send a cmd, subcmd packet, add chk (one word parameter).
int bfb_write_subcmd2 | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t | subtype, | |||
uint16_t | p1, | |||
uint16_t | p2 | |||
) |
Send a cmd, subcmd packet, add chk (two word parameter).
int bfb_write_subcmd3 | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t | subtype, | |||
uint16_t | p1, | |||
uint16_t | p2, | |||
uint16_t | p3 | |||
) |
Send a cmd, subcmd packet, add chk (three word parameter).
int bfb_write_subcmd8 | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t | subtype, | |||
uint8_t | p1 | |||
) |
Send a cmd, subcmd, data packet.
int bfb_write_subcmd_lw | ( | fd_t | fd, | |
uint8_t | type, | |||
uint8_t | subtype, | |||
uint32_t | p1, | |||
uint16_t | p2 | |||
) |
Send a cmd, subcmd packet, add long, word parameter.