File: PltUPnPObject.mm

package info (click to toggle)
xbmc 2%3A13.2%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 128,344 kB
  • ctags: 124,885
  • sloc: cpp: 678,122; ansic: 337,697; xml: 67,848; makefile: 10,193; sh: 8,957; pascal: 8,049; objc: 4,283; python: 3,179; asm: 2,510; java: 2,051; perl: 1,408; yacc: 1,315; tcl: 1,048; cs: 757; lisp: 506; awk: 222; lex: 148; ruby: 126; sed: 109
file content (120 lines) | stat: -rw-r--r-- 2,297 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//
//  PltUPnPObject.mm
//  Platinum
//
//  Created by Sylvain on 9/14/10.
//  Copyright 2010 Plutinosoft LLC. All rights reserved.
//

#import "Platinum.h"
#import "PltUPnPObject.h"

/*----------------------------------------------------------------------
|   PLT_ActionObject
+---------------------------------------------------------------------*/
/*@interface PLT_ActionObject (priv)
- (id)initWithAction:(PLT_Action*)action;
@end*/

@implementation PLT_ActionObject

- (id)initWithAction:(PLT_Action *)_action
{
    if ((self = [super init])) {
        action = _action;
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (NPT_Result)setValue:(NSString *)value forArgument:(NSString *)argument
{
    return action->SetArgumentValue([argument UTF8String], [value UTF8String]);
}

- (NPT_Result)setErrorCode:(unsigned int)code withDescription:(NSString*)description
{
    return action->SetError(code, [description UTF8String]);
}

@end

/*----------------------------------------------------------------------
|   PLT_DeviceHostObject
+---------------------------------------------------------------------*/
@interface PLT_DeviceHostObject (priv)
- (PLT_DeviceHostReference&)getDevice;
@end

@implementation PLT_DeviceHostObject

- (id)initWithDeviceHost:(PLT_DeviceHostReference*)_device
{
    if ((self = [super init])) {
        device = new PLT_DeviceHostReference(*_device);
    }
    return self;
}

- (void)dealloc
{
    delete device;
    [super dealloc];
}

- (PLT_DeviceHostReference&)getDevice 
{
    return *device;
}

@end

/*----------------------------------------------------------------------
|   PLT_UPnPObject
+---------------------------------------------------------------------*/
@implementation PLT_UPnPObject

- (id)init
{
    if ((self = [super init])) {
        upnp = new PLT_UPnP();
    }
    return self;
}

-(void) dealloc
{
    delete upnp;
    [super dealloc];
}

- (NPT_Result)start
{
    return upnp->Start();
}

- (NPT_Result)stop
{
    return upnp->Stop();
}

- (bool)isRunning
{
    return upnp->IsRunning();
}

- (NPT_Result)addDevice:(PLT_DeviceHostObject*)device
{
    return upnp->AddDevice([device getDevice]);
}

- (NPT_Result)removeDevice:(PLT_DeviceHostObject*)device
{
    return upnp->RemoveDevice([device getDevice]);
}

@end