RSS

(root)/iphone/common : 48 : tappity/source/Tappity.m

To get this branch, use:
bzr branch /browse/iphone/common

« back to all changes in this revision

Viewing changes to tappity/source/Tappity.m

Dömötör Gulyás
2009-10-28 02:04:32
Revision ID: dognotdog@gmail.com-20091028010432-ncgjtcsyxavch41q
tappity improvements

Show diffs side-by-side

added added

removed removed

24
24
NSString* TapGSEventKey = @"tapGSEvent";
25
25
NSString* TapTouchPhaseKey = @"tapTouchPhase";
26
26
NSString* TapRecordedEventKey = @"tapRecordedEvent";
27
 
 
28
 
 
 
27
NSString* TapAccelerationKey = @"tapAcceleration";
 
28
NSString* TapCompassKey = @"tapCompass";
 
29
NSString* TapLocationKey = @"tapLocation";
 
30
 
 
31
 
 
32
@interface Tappity (Private)
 
33
- (void) dataReceived: (NSData*) data;
 
34
@end
29
35
 
30
36
@implementation Tappity
31
37
 
99
105
                                        expectedMessageSize = ntohl(buf);
100
106
                                        currentData = [[NSMutableData alloc] initWithLength: expectedMessageSize];
101
107
                                }
102
 
                                else if (!actuallyRead)
103
 
                                {
104
 
                                        // close this socket as nothing read means connection closed
105
 
                                        close(commsSocket);
106
 
                                        self->commsSocket = 0;
107
 
                                        printf("Connection dropped.\n");
108
 
                                        break;
109
 
                                }
110
 
                                if (actuallyRead == -1)
111
 
                                {
112
 
                                        close(commsSocket);
113
 
                                        self->commsSocket = 0;
114
 
                                        printf("Connection dropped with error.\n");
115
 
                                        break;
 
108
                                else if (actuallyRead == -1)
 
109
                                {
 
110
                                        //close(commsSocket);
 
111
                                        //self->commsSocket = 0;
 
112
                                        if (errno != ETIMEDOUT)
 
113
                                        {
 
114
                                                printf("Connection dropped with error.\n");
 
115
                                                break;
 
116
                                        }
116
117
                                }
117
118
                        }
118
119
                        else
143
144
                                                */
144
145
                                                
145
146
                                        }
146
 
                                        [self performSelectorOnMainThread: @selector(dataReceived:) withObject: currentData waitUntilDone: NO];
 
147
 
 
148
                                        if (receiveDataOnMainThread)
 
149
                                                [self performSelectorOnMainThread: @selector(dataReceived:) withObject: currentData waitUntilDone: NO];
 
150
                                        else
 
151
                                                [self dataReceived: currentData];
 
152
 
147
153
                                        currentData = nil;
148
154
                                        currentlyRead = 0;
149
155
                                }

Loggerhead 1.17 is a web-based interface for Bazaar branches