author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /gammu/emb/common | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | gammu/emb/common/common.pro | 4 | ||||
-rw-r--r-- | gammu/emb/common/device/bluetoth/blue_w32.c | 4 | ||||
-rw-r--r-- | gammu/emb/common/device/bluetoth/blue_w32.h | 4 | ||||
-rw-r--r-- | gammu/emb/common/device/serial/ser_w32.h | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/gammu/emb/common/common.pro b/gammu/emb/common/common.pro index af45382..65fd303 100644 --- a/gammu/emb/common/common.pro +++ b/gammu/emb/common/common.pro @@ -1,194 +1,196 @@ ###################################################################### # Automatically generated by qmake (1.07a) Fri Jul 30 22:13:34 2004 ###################################################################### TEMPLATE = lib DEPENDPATH += device \ misc \ phone \ protocol \ service \ device/bluetoth \ device/irda \ device/serial \ misc/coding \ phone/alcatel \ phone/at \ phone/nokia \ phone/obex \ phone/symbian \ protocol/alcatel \ protocol/at \ protocol/nokia \ protocol/obex \ protocol/symbian \ service/backup \ service/sms \ phone/nokia/dct3 \ phone/nokia/dct4 INCLUDEPATH += . \ misc/coding \ misc \ device \ phone/nokia/dct4 \ phone/nokia/dct3 \ phone/at \ phone/alcatel \ phone/obex \ phone/symbian \ protocol \ protocol/nokia \ protocol/at \ protocol/alcatel \ protocol/obex \ protocol/symbian \ device/serial \ device/irda \ device/bluetoth \ service \ service/sms \ service/backup \ phone/nokia \ phone # Input HEADERS += config.h \ gammu.h \ gsmcomon.h \ gsmstate.h \ device/devfunc.h \ misc/cfg.h \ misc/misc.h \ phone/pfunc.h \ protocol/protocol.h \ service/gsmcal.h \ service/gsmcall.h \ service/gsmdata.h \ service/gsmlogo.h \ service/gsmmisc.h \ service/gsmnet.h \ service/gsmpbk.h \ service/gsmprof.h \ service/gsmring.h \ device/bluetoth/affix.h \ device/bluetoth/bluetoth.h \ device/bluetoth/bluez.h \ device/irda/irda.h \ device/serial/ser_djg.h \ misc/coding/coding.h \ misc/coding/md5.h \ phone/alcatel/alcatel.h \ phone/at/atgen.h \ phone/nokia/ncommon.h \ phone/nokia/nfunc.h \ phone/nokia/nfuncold.h \ phone/obex/obexgen.h \ phone/symbian/mroutgen.h \ protocol/alcatel/alcabus.h \ protocol/at/at.h \ protocol/nokia/fbus2.h \ protocol/nokia/mbus2.h \ protocol/nokia/phonet.h \ protocol/obex/obex.h \ protocol/symbian/mrouter.h \ service/backup/backgen.h \ service/backup/backics.h \ service/backup/backldif.h \ service/backup/backlmb.h \ service/backup/backtext.h \ service/backup/backvcf.h \ service/backup/backvcs.h \ service/backup/gsmback.h \ service/sms/gsmems.h \ service/sms/gsmmulti.h \ service/sms/gsmsms.h \ phone/nokia/dct3/dct3comm.h \ phone/nokia/dct3/dct3func.h \ phone/nokia/dct3/n6110.h \ phone/nokia/dct3/n7110.h \ phone/nokia/dct3/n0650.h \ phone/nokia/dct3/n9210.h \ phone/nokia/dct4/dct4func.h \ phone/nokia/dct4/n3320.h \ phone/nokia/dct4/n3650.h \ phone/nokia/dct4/n6510.h SOURCES +=gsmcomon.c \ gsmstate.c \ misc/misc.c \ misc/cfg.c \ misc/coding/coding.c \ misc/coding/md5.c \ service/sms/gsmsms.c \ service/sms/gsmems.c \ service/sms/gsmmulti.c \ service/gsmcal.c \ service/gsmdata.c \ service/gsmpbk.c \ service/gsmring.c \ service/gsmlogo.c \ service/gsmmisc.c \ service/gsmnet.c \ service/backup/gsmback.c \ service/backup/backldif.c \ service/backup/backlmb.c \ service/backup/backtext.c \ service/backup/backvcs.c \ service/backup/backvcf.c \ service/backup/backics.c \ device/bluetoth/affix.c \ device/bluetoth/bluez.c \ device/bluetoth/bluetoth.c \ device/serial/ser_djg.c \ device/irda/irda.c \ device/devfunc.c \ protocol/at/at.c \ protocol/alcatel/alcabus.c \ protocol/nokia/mbus2.c \ protocol/nokia/fbus2.c \ protocol/nokia/phonet.c \ protocol/obex/obex.c \ protocol/symbian/mrouter.c \ phone/pfunc.c \ phone/at/atgen.c \ phone/at/siemens.c \ phone/at/samsung.c \ phone/at/sonyeric.c \ phone/alcatel/alcatel.c \ phone/nokia/dct3/n6110.c \ phone/nokia/dct3/n7110.c \ phone/nokia/dct3/n0650.c \ phone/nokia/dct3/n9210.c \ phone/nokia/dct3/dct3func.c \ phone/nokia/dct4/n3320.c \ phone/nokia/dct4/n3650.c \ phone/nokia/dct4/n6510.c \ phone/nokia/dct4/dct4func.c \ phone/nokia/nauto.c \ phone/nokia/nfunc.c \ phone/nokia/nfuncold.c \ phone/obex/obexgen.c \ phone/symbian/mroutgen.c DEFINES += DESKTOP_VERSION -TARGET = microgammu +TARGET = xmicrogammu CONFIG = warn_off release console DESTDIR = ../../../bin OBJECTS_DIR = obj/unix MOC_DIR = moc/unix unix: { HEADERS += device/serial/ser_unx.h \ device/irda/irda_unx.h SOURCES += device/serial/ser_unx.c \ } win32:{ HEADERS += device/serial/ser_w32.h \ device/irda/irda_w32.h \ device/bluetoth/blue_w32.h SOURCES += device/serial/ser_w32.c \ device/bluetoth/blue_w32.c } +#The following line was inserted by qt3to4 +QT += xml qt3support diff --git a/gammu/emb/common/device/bluetoth/blue_w32.c b/gammu/emb/common/device/bluetoth/blue_w32.c index a631c9f..8a367f4 100644 --- a/gammu/emb/common/device/bluetoth/blue_w32.c +++ b/gammu/emb/common/device/bluetoth/blue_w32.c @@ -1,216 +1,216 @@ /* (c) 2003-2004 by Marcin Wiacek and Intra */ #include "../../gsmstate.h" #ifdef GSM_ENABLE_BLUETOOTHDEVICE #ifdef WIN32 #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <windows.h> #include <io.h> #include "../../misc/coding/coding.h" #include "../../gsmcomon.h" #include "../devfunc.h" #include "bluetoth.h" #include "blue_w32.h" GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device) { GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; WSADATA wsaData; SOCKADDR_BTH sab; int i; smprintf(s, "Connecting to RF channel %i\n",port); WSAStartup(MAKEWORD(1,1), &wsaData); d->hPhone = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); if (d->hPhone == INVALID_SOCKET) { i = GetLastError(); GSM_OSErrorInfo(s, "Socket in bluetooth_open"); if (i == 10041) return ERR_DEVICENODRIVER;//unknown socket type return ERR_UNKNOWN; } memset (&sab, 0, sizeof(sab)); sab.port = port; sab.addressFamily = AF_BTH; sab.btAddr = 0; for (i=0;i<(int)strlen(device);i++) { if (device[i] >='0' && device[i] <='9') { sab.btAddr = sab.btAddr * 16; sab.btAddr = sab.btAddr + (device[i]-'0'); } if (device[i] >='a' && device[i] <='f') { sab.btAddr = sab.btAddr * 16; sab.btAddr = sab.btAddr + (device[i]-'a'+10); } if (device[i] >='A' && device[i] <='F') { sab.btAddr = sab.btAddr * 16; sab.btAddr = sab.btAddr + (device[i]-'A'+10); } } dbgprintf("Remote Bluetooth device is %04x%08x\n", GET_NAP(sab.btAddr), GET_SAP(sab.btAddr)); if (connect (d->hPhone, (struct sockaddr *)&sab, sizeof(sab)) != 0) { i = GetLastError(); GSM_OSErrorInfo(s, "Connect in bluetooth_open"); if (i == 10060) return ERR_TIMEOUT; //remote device failed to respond if (i == 10050) return ERR_DEVICENOTWORK; //socket operation connected with dead network //noauth close(d->hPhone); return ERR_UNKNOWN; } return ERR_NONE; } #ifdef BLUETOOTH_RF_SEARCHING #pragma comment(lib, "irprops.lib") #pragma comment(lib, "ws2_32.lib") static GSM_Error bluetooth_checkdevice(GSM_StateMachine *s, char *address, WSAPROTOCOL_INFO *protocolInfo) { GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; WSAQUERYSET querySet; DWORD flags; GUID protocol; int i, result; BYTE buffer[2000]; char addressAsString[1000]; DWORD bufferLength, addressSize; WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer; - HANDLE handle; + Qt::HANDLE handle; GSM_Error error; memset(&querySet, 0, sizeof(querySet)); querySet.dwSize = sizeof(querySet); protocol = L2CAP_PROTOCOL_UUID; querySet.lpServiceClassId = &protocol; querySet.dwNameSpace = NS_BTH; querySet.lpszContext = address; flags = LUP_FLUSHCACHE | LUP_RETURN_NAME | LUP_RETURN_TYPE | LUP_RETURN_ADDR | LUP_RETURN_BLOB | LUP_RETURN_COMMENT; result = WSALookupServiceBegin(&querySet, flags, &handle); if (result != 0) return ERR_UNKNOWN; bufferLength = sizeof(buffer); while (1) { result = WSALookupServiceNext(handle, flags, &bufferLength, pResults); if (result != 0) break; addressSize = sizeof(addressAsString); addressAsString[0] = 0; if (WSAAddressToString(pResults->lpcsaBuffer->RemoteAddr.lpSockaddr, pResults->lpcsaBuffer->RemoteAddr.iSockaddrLength, protocolInfo, addressAsString,&addressSize)==0) { smprintf(s, "%s - ", addressAsString); } smprintf(s, "\"%s\"\n", pResults->lpszServiceInstanceName); if (addressAsString[0] != 0) { for (i=strlen(addressAsString)-1;i>0;i--) { if (addressAsString[i] == ':') break; } if (bluetooth_checkservicename(s, pResults->lpszServiceInstanceName) == ERR_NONE) { error = bluetooth_connect(s,atoi(addressAsString+i+1),address+1); result = WSALookupServiceEnd(handle); return error; } } } result = WSALookupServiceEnd(handle); return ERR_NOTSUPPORTED; } GSM_Error bluetooth_findchannel(GSM_StateMachine *s) { GSM_Device_BlueToothData *d = &s->Device.Data.BlueTooth; WSADATA wsaData; int i, protocolInfoSize, result; WSAPROTOCOL_INFO protocolInfo; - HANDLE handle; + Qt::HANDLE handle; DWORD flags; WSAQUERYSET querySet; BYTE buffer[2000]; char addressAsString[1000]; DWORD bufferLength, addressSize; WSAQUERYSET *pResults = (WSAQUERYSET*)&buffer; GSM_Error error; if (WSAStartup(MAKEWORD(2,2), &wsaData)!=0x00) return ERR_DEVICENODRIVER; d->hPhone = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); if (d->hPhone == INVALID_SOCKET) { i = GetLastError(); GSM_OSErrorInfo(s, "Socket in bluetooth_open"); if (i == 10041) return ERR_DEVICENODRIVER;//unknown socket type return ERR_UNKNOWN; } protocolInfoSize = sizeof(protocolInfo); if (getsockopt(d->hPhone, SOL_SOCKET, SO_PROTOCOL_INFO, (char*)&protocolInfo, &protocolInfoSize) != 0) { close(d->hPhone); return ERR_UNKNOWN; } close(d->hPhone); if (!strcmp(s->CurrentConfig->Device,"com2:")) { bufferLength = sizeof(buffer); flags = LUP_RETURN_NAME | LUP_CONTAINERS | LUP_RETURN_ADDR | LUP_FLUSHCACHE | LUP_RETURN_TYPE | LUP_RETURN_BLOB | LUP_RES_SERVICE; memset(&querySet, 0, sizeof(querySet)); querySet.dwSize = sizeof(querySet); querySet.dwNameSpace = NS_BTH; result = WSALookupServiceBegin(&querySet, flags, &handle); if (result != 0) return ERR_UNKNOWN; while (1) { result = WSALookupServiceNext(handle, flags, &bufferLength, pResults); if (result != 0) break; smprintf(s, "\"%s\"", pResults->lpszServiceInstanceName); addressSize = sizeof(addressAsString); addressAsString[0] = 0; if (WSAAddressToString(pResults->lpcsaBuffer->RemoteAddr.lpSockaddr, pResults->lpcsaBuffer->RemoteAddr.iSockaddrLength, &protocolInfo, addressAsString,&addressSize)==0) { smprintf(s, " - %s\n", addressAsString); error = bluetooth_checkdevice(s, addressAsString,&protocolInfo); if (error == ERR_NONE) { result = WSALookupServiceEnd(handle); return error; } } else smprintf(s, "\n"); } result = WSALookupServiceEnd(handle); return ERR_NOTSUPPORTED; } else { return bluetooth_checkdevice(s, s->CurrentConfig->Device,&protocolInfo); } } #endif #endif #endif /* How should editor hadle tabs in this file? Add editor commands here. * vim: noexpandtab sw=8 ts=8 sts=8: */ diff --git a/gammu/emb/common/device/bluetoth/blue_w32.h b/gammu/emb/common/device/bluetoth/blue_w32.h index e457c92..409f4b1 100644 --- a/gammu/emb/common/device/bluetoth/blue_w32.h +++ b/gammu/emb/common/device/bluetoth/blue_w32.h @@ -1,188 +1,188 @@ GSM_Error bluetooth_connect(GSM_StateMachine *s, int port, char *device); GSM_Error bluetooth_findchannel(GSM_StateMachine *s); /* MS Platform SDK */ #ifndef __blue_w32_h #define __blue_w32_h #include <pshpack1.h> // Without it compiled code hangs up BT stack typedef ULONGLONG BTH_ADDR, *PBTH_ADDR; #define NAP_MASK ((ULONGLONG) 0xFFFF00000000) #define SAP_MASK ((ULONGLONG) 0x0000FFFFFFFF) #define NAP_BIT_OFFSET (8 * 4) #define SAP_BIT_OFFSET (0) #define GET_NAP(_bth_addr) ((USHORT) (((_bth_addr) & NAP_MASK) >> NAP_BIT_OFFSET)) #define GET_SAP(_bth_addr) ((ULONG) (((_bth_addr) & SAP_MASK) >> SAP_BIT_OFFSET)) #ifndef AF_BTH #define AF_BTH 32 #endif typedef struct _SOCKADDR_BTH { USHORT addressFamily; // Always AF_BTH BTH_ADDR btAddr; // Bluetooth device address GUID serviceClassId; // [OPTIONAL] system will query SDP for port ULONG port; // RFCOMM channel or L2CAP PSM } SOCKADDR_BTH, *PSOCKADDR_BTH; #define BTHPROTO_RFCOMM 0x0003 #ifdef BLUETOOTH_RF_SEARCHING typedef struct _SOCKET_ADDRESS { LPSOCKADDR lpSockaddr ; INT iSockaddrLength ; } SOCKET_ADDRESS, *PSOCKET_ADDRESS, FAR * LPSOCKET_ADDRESS ; typedef struct _CSADDR_INFO { SOCKET_ADDRESS LocalAddr ; SOCKET_ADDRESS RemoteAddr ; INT iSocketType ; INT iProtocol ; } CSADDR_INFO, *PCSADDR_INFO, FAR * LPCSADDR_INFO ; typedef struct _AFPROTOCOLS { INT iAddressFamily; INT iProtocol; } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS; typedef enum _WSAEcomparator { COMP_EQUAL = 0, COMP_NOTLESS } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR; typedef struct _WSAVersion { DWORD dwVersion; WSAECOMPARATOR ecHow; }WSAVERSION, *PWSAVERSION, *LPWSAVERSION; typedef struct _WSAQuerySetA { DWORD dwSize; LPSTR lpszServiceInstanceName; LPGUID lpServiceClassId; LPWSAVERSION lpVersion; LPSTR lpszComment; DWORD dwNameSpace; LPGUID lpNSProviderId; LPSTR lpszContext; DWORD dwNumberOfProtocols; LPAFPROTOCOLS lpafpProtocols; LPSTR lpszQueryString; DWORD dwNumberOfCsAddrs; LPCSADDR_INFO lpcsaBuffer; DWORD dwOutputFlags; LPBLOB lpBlob; } WSAQUERYSET, WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA; DEFINE_GUID(L2CAP_PROTOCOL_UUID, 0x00000100, 0x0000, 0x1000, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB); #ifndef NS_BTH # define NS_BTH 16 #endif #define LUP_CONTAINERS 0x0002 #define LUP_RETURN_NAME 0x0010 #define LUP_RETURN_TYPE 0x0020 #define LUP_RETURN_COMMENT 0x0080 #define LUP_RETURN_ADDR 0x0100 #define LUP_RETURN_BLOB 0x0200 #define LUP_FLUSHCACHE 0x1000 #define LUP_RES_SERVICE 0x8000 #define WSAAPI FAR PASCAL #ifndef WINSOCK_API_LINKAGE #ifdef DECLSPEC_IMPORT #define WINSOCK_API_LINKAGE DECLSPEC_IMPORT #else #define WINSOCK_API_LINKAGE #endif #endif WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceBeginA( IN LPWSAQUERYSETA lpqsRestrictions, IN DWORD dwControlFlags, OUT LPHANDLE lphLookup ); #define WSALookupServiceBegin WSALookupServiceBeginA WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceNextA( - IN HANDLE hLookup, + IN Qt::HANDLE hLookup, IN DWORD dwControlFlags, IN OUT LPDWORD lpdwBufferLength, OUT LPWSAQUERYSETA lpqsResults ); #define WSALookupServiceNext WSALookupServiceNextA -WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceEnd(IN HANDLE hLookup); +WINSOCK_API_LINKAGE INT WSAAPI WSALookupServiceEnd(IN Qt::HANDLE hLookup); #define MAX_PROTOCOL_CHAIN 7 typedef struct _WSAPROTOCOLCHAIN { int ChainLen; /* the length of the chain, */ /* length = 0 means layered protocol, */ /* length = 1 means base protocol, */ /* length > 1 means protocol chain */ DWORD ChainEntries[MAX_PROTOCOL_CHAIN]; /* a list of dwCatalogEntryIds */ } WSAPROTOCOLCHAIN, FAR * LPWSAPROTOCOLCHAIN; #define WSAPROTOCOL_LEN 255 typedef struct _WSAPROTOCOL_INFOA { DWORD dwServiceFlags1; DWORD dwServiceFlags2; DWORD dwServiceFlags3; DWORD dwServiceFlags4; DWORD dwProviderFlags; GUID ProviderId; DWORD dwCatalogEntryId; WSAPROTOCOLCHAIN ProtocolChain; int iVersion; int iAddressFamily; int iMaxSockAddr; int iMinSockAddr; int iSocketType; int iProtocol; int iProtocolMaxOffset; int iNetworkByteOrder; int iSecurityScheme; DWORD dwMessageSize; DWORD dwProviderReserved; CHAR szProtocol[WSAPROTOCOL_LEN+1]; } WSAPROTOCOL_INFOA, FAR * LPWSAPROTOCOL_INFOA; typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO; #define SO_PROTOCOL_INFOA 0x2004 /* WSAPROTOCOL_INFOA structure */ #define SO_PROTOCOL_INFO SO_PROTOCOL_INFOA WINSOCK_API_LINKAGE INT WSAAPI WSAAddressToStringA( IN LPSOCKADDR lpsaAddress, IN DWORD dwAddressLength, IN LPWSAPROTOCOL_INFOA lpProtocolInfo, IN OUT LPSTR lpszAddressString, IN OUT LPDWORD lpdwAddressStringLength ); #define WSAAddressToString WSAAddressToStringA #endif #endif /* How should editor hadle tabs in this file? Add editor commands here. * vim: noexpandtab sw=8 ts=8 sts=8: */ diff --git a/gammu/emb/common/device/serial/ser_w32.h b/gammu/emb/common/device/serial/ser_w32.h index d226f32..d1aa37a 100644 --- a/gammu/emb/common/device/serial/ser_w32.h +++ b/gammu/emb/common/device/serial/ser_w32.h @@ -1,19 +1,19 @@ #ifdef WIN32 #ifndef winserial_h #define winserial_h #include <windows.h> typedef struct { - HANDLE hPhone; + Qt::HANDLE hPhone; DCB old_settings; OVERLAPPED osWrite,osRead; } GSM_Device_SerialData; #endif #endif /* How should editor hadle tabs in this file? Add editor commands here. * vim: noexpandtab sw=8 ts=8 sts=8: */ |