20 #include "../../gsmstate.h" 22 #ifdef GSM_ENABLE_IRDADEVICE 33 # include <sys/time.h> 34 # include <sys/poll.h> 35 # include <sys/socket.h> 36 # include <sys/ioctl.h> 39 # define WIN32_LEAN_AND_MEAN 41 # include <winsock2.h> 45 #include "../../gsmcomon.h" 46 #include "../../gsmphones.h" 47 #include "../devfunc.h" 54 unsigned char *buf=NULL;
55 int sec=0,s=0,z=0,len=0,i=0,deviceid=0;
62 (*fd) = socket(
AF_IRDA, SOCK_STREAM, 0);
65 if (*fd == INVALID_SOCKET) {
76 buf = (
unsigned char *)malloc(len);
88 for (i = 0; i < (int)list->
numDevice; i++) {
98 smprintf(state,
"IrDA: found device \"%s\" (address %d) - ",
112 for(index=0; index <= 3; index++)
122 if (founddevice)
break;
126 if (founddevice)
break;
132 socket_close(state, *fd);
143 int Enable9WireMode = 1;
149 WSAStartup(MAKEWORD(1,1), &wsaData);
159 if (irda_discover_device(s,&fd) ==
FALSE) {
160 smprintf(s,
"Can not find any IrDA device!\n");
189 if (connect(fd, (
struct sockaddr *)&d->
peer,
sizeof(d->
peer))) {
194 smprintf(s,
"Trying alternate config: IrDA:OBEX\n");
196 if (connect(fd, (
struct sockaddr *)&d->
peer,
sizeof(d->
peer))) {
198 smprintf(s,
"Trying alternate config: OBEX:IrXfer\n");
200 if (!connect(fd, (
struct sockaddr *)&d->
peer,
sizeof(d->
peer))) {
220 return socket_read(s, buf, nbytes, s->
Device.
Data.Irda.hPhone);
225 return socket_write(s, buf, nbytes, s->
Device.
Data.Irda.hPhone);
230 return socket_close(s, s->
Device.
Data.Irda.hPhone);
GSM_Config * CurrentConfig
union GSM_Device::@0 Data
GSM_ConnectionType ConnectionType
sa_family_t irdaAddressFamily
struct sockaddr_irda peer
GSM_PhoneModel * ModelInfo
#define IRLMP_ENUMDEVICES
GSM_PhoneModel * GetModelData(GSM_StateMachine *s, const char *model, const char *number, const char *irdamodel)
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
struct irda_device_info Device[1]
char Model[GSM_MAX_MODEL_LENGTH+1]
int smprintf(GSM_StateMachine *s, const char *format,...)