2015-02-01 04:26:47 -05:00
|
|
|
//
|
|
|
|
|
// ServerInfoResponse.m
|
2015-05-12 21:48:30 -04:00
|
|
|
// Moonlight
|
2015-02-01 04:26:47 -05:00
|
|
|
//
|
|
|
|
|
// Created by Diego Waxemberg on 2/1/15.
|
2015-05-12 21:48:30 -04:00
|
|
|
// Copyright (c) 2015 Moonlight Stream. All rights reserved.
|
2015-02-01 04:26:47 -05:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "ServerInfoResponse.h"
|
|
|
|
|
#import <libxml2/libxml/xmlreader.h>
|
|
|
|
|
|
|
|
|
|
@implementation ServerInfoResponse
|
|
|
|
|
@synthesize data, statusCode, statusMessage;
|
|
|
|
|
|
|
|
|
|
- (void) populateWithData:(NSData *)xml {
|
|
|
|
|
self.data = xml;
|
|
|
|
|
[super parseData];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) populateHost:(Host*)host {
|
2015-04-05 20:30:13 -07:00
|
|
|
host.name = [[self getStringTag:TAG_HOSTNAME] trim];
|
|
|
|
|
host.externalAddress = [[self getStringTag:TAG_EXTERNAL_IP] trim];
|
|
|
|
|
host.localAddress = [[self getStringTag:TAG_LOCAL_IP] trim];
|
|
|
|
|
host.uuid = [[self getStringTag:TAG_UNIQUE_ID] trim];
|
|
|
|
|
host.mac = [[self getStringTag:TAG_MAC_ADDRESS] trim];
|
2015-02-01 04:26:47 -05:00
|
|
|
|
2015-02-01 18:33:36 -05:00
|
|
|
NSInteger pairStatus;
|
|
|
|
|
if ([self getIntTag:TAG_PAIR_STATUS value:&pairStatus]) {
|
|
|
|
|
host.pairState = pairStatus ? PairStatePaired : PairStateUnpaired;
|
|
|
|
|
} else {
|
|
|
|
|
host.pairState = PairStateUnknown;
|
2015-02-01 04:26:47 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|