mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-15 21:21:45 +00:00
Created new host discovery system
- now store host uuid and mac address - use uuid to check for duplicate hosts - try local and external IPs - pair status is shown - server status is shown - validate host when manually adding
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// Computer.h
|
||||
// Limelight
|
||||
//
|
||||
// Created by Diego Waxemberg on 10/14/14.
|
||||
// Copyright (c) 2014 Limelight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface Computer : NSObject
|
||||
@property NSString* displayName;
|
||||
@property NSString* hostName;
|
||||
@property BOOL paired;
|
||||
|
||||
- (id) initWithHost:(NSNetService*)host;
|
||||
- (id) initWithIp:(NSString*)host;
|
||||
|
||||
@end
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// Computer.m
|
||||
// Limelight
|
||||
//
|
||||
// Created by Diego Waxemberg on 10/14/14.
|
||||
// Copyright (c) 2014 Limelight Stream. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Computer.h"
|
||||
|
||||
@implementation Computer
|
||||
|
||||
- (id) initWithHost:(NSNetService *)host {
|
||||
self = [super init];
|
||||
|
||||
self.hostName = [host hostName];
|
||||
self.displayName = [host name];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithIp:(NSString*)host {
|
||||
self = [super init];
|
||||
|
||||
self.hostName = host;
|
||||
self.displayName = host;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object {
|
||||
if ([object isKindOfClass:[Computer class]]) {
|
||||
return [self.hostName isEqual:[object valueForKey:@"hostName"]];
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
NSUInteger prime = 31;
|
||||
NSUInteger result = 1;
|
||||
result = prime * result + (self.hostName == nil ? 0 : [self.hostName hash]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -10,6 +10,14 @@
|
||||
|
||||
@interface Utils : NSObject
|
||||
|
||||
typedef NS_ENUM(int, PairState) {
|
||||
PairStateUnknown,
|
||||
PairStateUnpaired,
|
||||
PairStatePaired
|
||||
};
|
||||
|
||||
FOUNDATION_EXPORT NSString *const deviceName;
|
||||
|
||||
+ (NSData*) randomBytes:(NSInteger)length;
|
||||
+ (NSString*) bytesToHex:(NSData*)data;
|
||||
+ (NSData*) hexToBytes:(NSString*) hex;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <netdb.h>
|
||||
|
||||
@implementation Utils
|
||||
NSString *const deviceName = @"roth";
|
||||
|
||||
+ (NSData*) randomBytes:(NSInteger)length {
|
||||
char* bytes = malloc(length);
|
||||
|
||||
Reference in New Issue
Block a user