Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-event-test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stas Korobeynikov
wx-event-test
Commits
59eebabd
Commit
59eebabd
authored
Nov 18, 2016
by
Stas Korobeynikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add special assync process
parent
b22eb710
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
0 deletions
+80
-0
asyncprocess.cpp
asyncprocess.cpp
+43
-0
asyncprocess.h
asyncprocess.h
+26
-0
opennxtestevent.cpp
opennxtestevent.cpp
+10
-0
opennxtestevent.h
opennxtestevent.h
+1
-0
No files found.
asyncprocess.cpp
0 → 100644
View file @
59eebabd
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "asyncprocess.h"
#endif
#include "wx/wxprec.h"
#include "stdio.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "asyncprocess.h"
IMPLEMENT_DYNAMIC_CLASS
(
AsyncProcess
,
wxProcess
)
AsyncProcess
::
AsyncProcess
()
:
wxProcess
(),
wxThreadHelper
()
{
Redirect
();
}
void
AsyncProcess
::
start
()
{
int
pid
;
const
char
*
cmd
=
"nxssh -nx -x -2 -p 2222 -o 'RhostsAuthentication no' -o 'PasswordAuthentication no' -o 'RSAAuthentication no' -o 'RhostsRSAAuthentication no' -o 'PubkeyAuthentication yes' -i /usr/lib64/opennx/share/keys/server.id_dsa.key -B -E nx@192.168.4.58"
;
pid
=
wxExecute
(
cmd
,
wxEXEC_ASYNC
,
this
);
printf
(
"pid: %d
\n
"
,
pid
);
}
wxThread
::
ExitCode
AsyncProcess
::
Entry
()
{
while
(
!
m_thread
->
TestDestroy
())
{
while
(
IsInputAvailable
())
{
char
c
=
GetInputStream
()
->
GetC
();
printf
(
"%c"
,
c
);
}
}
}
AsyncProcess
::~
AsyncProcess
()
{
}
void
AsyncProcess
::
OnTerminate
(
int
pid
,
int
status
)
{
}
asyncprocess.h
0 → 100644
View file @
59eebabd
#ifndef _ASYNCPROCESS_H_
#define _ASYNCPROCESS_H_
#include <wx/event.h>
#include <wx/process.h>
#include <wx/thread.h>
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "AsyncProcess.cpp"
#endif
class
AsyncProcess
:
public
wxProcess
,
public
wxThreadHelper
{
DECLARE_DYNAMIC_CLASS
(
AsyncProcess
)
public
:
AsyncProcess
();
void
start
();
virtual
~
AsyncProcess
();
virtual
wxThread
::
ExitCode
Entry
();
virtual
void
OnTerminate
(
int
pid
,
int
status
);
};
#endif
\ No newline at end of file
opennxtestevent.cpp
View file @
59eebabd
...
...
@@ -5,16 +5,25 @@
#endif
#include "opennxtestevent.h"
#include "asyncprocess.h"
IMPLEMENT_APP
(
OpennxTestEvent
)
BEGIN_EVENT_TABLE
(
OpennxTestEvent
,
wxEvtHandler
)
END_EVENT_TABLE
();
// This is executed upon startup, like 'main()' in non-wxWidgets programs.
bool
OpennxTestEvent
::
OnInit
()
{
AsyncProcess
*
ap
=
new
AsyncProcess
();
wxFrame
*
frame
=
new
wxFrame
((
wxFrame
*
)
NULL
,
-
1
,
_T
(
"Test opennx event"
));
frame
->
CreateStatusBar
();
frame
->
SetStatusText
(
_T
(
"Test opennx event"
));
frame
->
Show
(
true
);
SetTopWindow
(
frame
);
ap
->
start
();
return
true
;
}
\ No newline at end of file
opennxtestevent.h
View file @
59eebabd
...
...
@@ -3,6 +3,7 @@
class
OpennxTestEvent
:
public
wxApp
{
DECLARE_EVENT_TABLE
();
public
:
virtual
bool
OnInit
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment