Small fixes and cleanup
This commit is contained in:
parent
94d7be1791
commit
582f667e65
@ -37,7 +37,6 @@ BOOL wasOpenned = FALSE;
|
||||
[inputStream open];
|
||||
|
||||
outputStream = (__bridge NSOutputStream *)writeStream;
|
||||
//[outputStream setDelegate:self];
|
||||
[outputStream open];
|
||||
|
||||
[self performSelectorOnMainThread:@selector(runReadLoop) withObject:nil waitUntilDone:NO];
|
||||
@ -125,13 +124,11 @@ BOOL wasOpenned = FALSE;
|
||||
case NSStreamEventHasBytesAvailable: {
|
||||
if(stream == inputStream) {
|
||||
uint8_t buf[65535];
|
||||
unsigned int len = 0;
|
||||
|
||||
len = [inputStream read:buf maxLength:65535];
|
||||
NSLog(@"%d", len);
|
||||
long len = [inputStream read:buf maxLength:65535];
|
||||
|
||||
if(len > 0) {
|
||||
NSMutableArray *dataArray = [[NSMutableArray alloc] init];
|
||||
for (int i = 0; i < len; i++) {
|
||||
for (long i = 0; i < len; i++) {
|
||||
|
||||
[dataArray addObject:[NSNumber numberWithUnsignedChar:buf[i]]];
|
||||
}
|
||||
@ -184,6 +181,7 @@ BOOL wasOpenned = FALSE;
|
||||
}
|
||||
|
||||
- (void)close {
|
||||
self.closeEventHandler(FALSE);
|
||||
[self closeOutputStream];
|
||||
[self closeInputStream];
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
NSMutableDictionary *socketAdapters;
|
||||
}
|
||||
|
||||
-(void) create: (CDVInvokedUrlCommand *) command;
|
||||
-(void) connect: (CDVInvokedUrlCommand *) command;
|
||||
-(void) write: (CDVInvokedUrlCommand *) command;
|
||||
-(void) close: (CDVInvokedUrlCommand *) command;
|
||||
|
@ -5,15 +5,6 @@
|
||||
|
||||
@implementation SocketPlugin : CDVPlugin
|
||||
|
||||
- (void) create : (CDVInvokedUrlCommand*) command {
|
||||
//NSString* socketKey = [command.arguments objectAtIndex : 0];
|
||||
|
||||
|
||||
[self.commandDelegate
|
||||
sendPluginResult: [CDVPluginResult resultWithStatus : CDVCommandStatus_OK]
|
||||
callbackId: command.callbackId];
|
||||
}
|
||||
|
||||
- (void) connect : (CDVInvokedUrlCommand*) command {
|
||||
|
||||
NSString *socketKey = [command.arguments objectAtIndex:0];
|
||||
|
Loading…
Reference in New Issue
Block a user