blob: be7632b770d73bc6eb50c13f40f6033a98143985 [file] [log] [blame]
Alexander Afanasyev14b09482013-10-11 18:24:45 +02001/* -*- Mode: objc; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07002/**
3 * Copyright (c) 2013-2014, Regents of the University of California,
Alexander Afanasyev6cacb972013-10-03 23:39:06 -07004 *
Alexander Afanasyevb6392e32014-05-12 23:43:50 -07005 * This file is part of NFD Control Center. See AUTHORS.md for complete list of NFD
6 * authors and contributors.
7 *
8 * NFD Control Center is free software: you can redistribute it and/or modify it under the
9 * terms of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NFD Control Center is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with NFD
17 * Control Center, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * \author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
20 * \author Ilya Moiseenko <http://ilyamoiseenko.com/>
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070021 */
22
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070023#include "config.hpp"
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070024#import "ndnd-status-operation.h"
25
26@implementation NdndStatusOperation
27
28-(id)initWithDelegate:(MenuDelegate*)delegate
29{
30 if (![super init]) return nil;
31 m_delegate = delegate;
32 return self;
33}
34
35-(void)main
36{
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070037 // NSTask *task = [[NSTask alloc] init];
38 // [task setLaunchPath: @NDND_STATUS_COMMAND];
39 // [task setArguments: [NSArray arrayWithObjects: @"status",@"-x",nil]];
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070040
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070041 // NSPipe * out = [NSPipe pipe];
42 // [task setStandardOutput:out];
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070043
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070044 // [task launch];
45 // [task waitUntilExit];
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070046
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070047 // NSFileHandle * read = [out fileHandleForReading];
48 // NSData * dataRead = [read readDataToEndOfFile];
49 // NSString *stringRead = [[NSString alloc] initWithData:dataRead encoding:NSUTF8StringEncoding];
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070050
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070051 // if ([stringRead isEqualToString:@""]) {
52 // [m_delegate performSelectorOnMainThread:@selector(statusUnavailable:)
53 // withObject:nil
54 // waitUntilDone:YES];
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070055
Alexander Afanasyevb6392e32014-05-12 23:43:50 -070056 // } else {
57 // NSError *error = nil;
58 // NSXMLDocument *document = [[NSXMLDocument alloc]
59 // initWithXMLString:stringRead
60 // options:0
61 // error:&error];
62
63 // [m_delegate performSelectorOnMainThread:@selector(statusUpdated:)
64 // withObject:document
65 // waitUntilDone:YES];
66 // }
Alexander Afanasyev6cacb972013-10-03 23:39:06 -070067}
68
69@end