Permalink
Browse files

Trunk: a bunch of minor fixes.

git-svn-id: svn://localhost/public/MoSync/trunk@1239 6ad7a17e-d552-4a1e-ace4-f958fe14b117
  • Loading branch information...
1 parent 49abda3 commit 6a7ea933cd0619908e05a9bb0987ea758d6fadfd fredrik committed May 19, 2010
View
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
Name="MoSyncRules"
- Version="8,00"
+ Version="8.00"
>
<Rules>
<CustomBuildRule
Name="MoSync resource"
DisplayName="MoSync resource"
CommandLine="pipe-tool -R resources $(InputPath)"
- Outputs="resources MAHeaders.h"
+ Outputs="MAHeaders.h"
FileExtensions="*.lst"
+ ExecutionDescription="Executing tool..."
>
<Properties>
</Properties>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="8,00"
+ Version="8.00"
Name="kazlib"
ProjectGUID="{D8F13023-5CDF-46DC-BE49-CE695A8EE033}"
RootNamespace="kazlib"
@@ -47,7 +47,7 @@
UsePrecompiledHeader="0"
WarningLevel="3"
WarnAsError="true"
- DebugInformationFormat="4"
+ DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -713,6 +713,7 @@ class VMCoreInt : public VMCore {
DUMPHEX(Head.DataSize);
if(Head.DataLen > 0) {
DATA_SEGMENT_SIZE = nextPowerOf2(16, Head.DataSize);
+ DUMPHEX(DATA_SEGMENT_SIZE);
mem_ds = new int[DATA_SEGMENT_SIZE / sizeof(int)];
if(!mem_ds) BIG_PHAT_ERROR(ERR_OOM);
TEST(file.read(mem_ds, Head.DataLen));
@@ -1531,8 +1531,12 @@ namespace Base {
TIME_ZONE_INFORMATION tzi;
DWORD res = GetTimeZoneInformation(&tzi);
MYASSERT(res != TIME_ZONE_ID_INVALID, WINERR_TIMEZONE);
- //return (int)(time(NULL) - ((tzi.Bias + tzi.StandardBias + tzi.DaylightBias) * 60));
- return (int)(time(NULL) - (tzi.Bias * 60));
+ int bias = tzi.Bias;
+ if(res == TIME_ZONE_ID_DAYLIGHT)
+ bias += tzi.DaylightBias;
+ if(res == TIME_ZONE_ID_STANDARD)
+ bias += tzi.StandardBias;
+ return (int)(time(NULL) - (bias * 60));
#else
time_t t = time(NULL);
tm* lt = localtime(&t);
View
@@ -1443,8 +1443,6 @@ interface MAAPI {
BINARY = 4;
UBIN = 5;
SKIP = 6;
- TILESET = 7;
- TILEMAP = 8;
LABEL = 9;
FLUX = 127;
}
View
@@ -64,26 +64,51 @@ static void dumpPacket(byte* p, int len) {
static int OBEXSendPacket(BtSppConnection& conn, u16 maxPacketSize, uint* fileOffset,
const Array<char>& file, const Array<u16>& name,
std::string mimeType);
+static int OBEXDisconnect(BtSppConnection& conn);
//TODO: implement OBEXDisconnect().
int sendObject(const MABtAddr& address, const Array<char>& file, const Array<u16>& name,
int port, int maxPacketSize)
{
+ LOG("Connecting...\n");
Smartie<BtSppConnection> conn(createBtSppConnection(&address, port));
TEST_LEZ(conn->connect());
+ LOG("Connected!\n");
u16 shortMPS = (u16)maxPacketSize;
TEST_LEZ(OBEXConnect(*conn, &shortMPS, file.size()));
- int res = OBEXPut(*conn, shortMPS, file, name);
- /*if(res <= 0) {
- OBEXDisconnect(*conn, shortMPS);
- }*/
- return res;
+ TEST_LEZ(OBEXPut(*conn, shortMPS, file, name));
+ TEST_LEZ(OBEXDisconnect(*conn));
+ return 1;
+}
+
+static int OBEXDisconnect(BtSppConnection& conn) {
+ LOG("OBEXDisconnect...\n");
+
+ //send packet
+ byte packet[3];
+ packet[0] = 0x81; // Disconnect
+ packet[1] = 0x00; // Packetlength Hi Byte
+ packet[2] = 0x03; // Packetlength Lo Byte
+ TEST_LEZ(conn.write(packet, sizeof(packet)));
+
+ //listen for server response
+ byte ReceiveBufferA[3];
+ TEST_LEZ(conn.readFully(ReceiveBufferA, 3));
+ dumpPacket(ReceiveBufferA, 3);
+
+ if(ReceiveBufferA[0] == 0xa0) {
+ LOG("Disconnect successful.\n");
+ return 1;
+ } else {
+ LOG("Unknown reply: 0x%02X\n", ReceiveBufferA[0]);
+ return CONNERR_OBEX;
+ }
}
//may decrease *maxPacketSize to match the remote device
//added the optional LENGTH header here. didn't do anything for the k800i prototype.
static int OBEXConnect(BtSppConnection& conn, u16* maxPacketSize, int fileSize) {
- printf("OBEXConnect...\n");
+ LOG("OBEXConnect...\n");
//send client request
byte ConnectPacket[0x11];
@@ -220,15 +245,15 @@ static int OBEXSendPacket(BtSppConnection& conn, u16 maxPacketSize, uint* fileOf
//Name Header
if(tNameLength && firstPacket) {
nameheadsize = (3 + (tNameLength*2) + 2);
- namesizeHi = (nameheadsize & 0xff00)/0xff;
+ namesizeHi = (nameheadsize & 0xff00) >> 8;
namesizeLo = nameheadsize & 0x00ff;
packetsize += nameheadsize;
}
//Type Header
if(tTypeLen && firstPacket) {
typeheadsize = 3 + tTypeLen+1;
- typesizeHi = (typeheadsize & 0xff00)/0xff;
+ typesizeHi = (typeheadsize & 0xff00) >> 8;
typesizeLo = typeheadsize & 0x00ff;
packetsize += typeheadsize;
}
@@ -241,15 +266,15 @@ static int OBEXSendPacket(BtSppConnection& conn, u16 maxPacketSize, uint* fileOf
//Body
int fileLen = MIN(maxPacketSize - packetsize - 3, file.size() - *fileOffset);
int fileheadsize = 3 + fileLen;
- int filesizeHi = (fileheadsize & 0xff00)/0xff;
+ int filesizeHi = (fileheadsize & 0xff00) >> 8;
int filesizeLo = fileheadsize & 0x00ff;
packetsize += fileheadsize;
bool last = *fileOffset + fileLen == file.size();
DEBUG_ASSERT(packetsize <= maxPacketSize);
- int packetsizeHi = (packetsize & 0xff00)/0xff;
+ int packetsizeHi = (packetsize & 0xff00) >> 8;
int packetsizeLo = packetsize & 0x00ff;
Array<byte> tSendByte(packetsize);
@@ -267,7 +292,7 @@ static int OBEXSendPacket(BtSppConnection& conn, u16 maxPacketSize, uint* fileOf
tSendByte[offset+2] = byte(namesizeHi); // Length of Name header (2 bytes per char)
tSendByte[offset+3] = byte(namesizeLo); // Length of Name header (2 bytes per char)
- // Name+\n\n in unicode
+ // Name + \0 in unicode
memcpy(tSendByte + offset + 4, name, tNameLength*2);
offset = offset + 3 + (tNameLength*2);

0 comments on commit 6a7ea93

Please sign in to comment.