Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
skylivex
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
astronomy
skylivex
Commits
79e46b4d
Commit
79e46b4d
authored
Feb 18, 2013
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wow, it seems to work now!
parent
0500997e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
38 deletions
+27
-38
skproto.cpp
plugins/skproto.cpp
+18
-1
skproto.h
plugins/skproto.h
+9
-1
ipcmsg.cpp
src/ipcmsg.cpp
+0
-20
ipcmsg.h
src/ipcmsg.h
+0
-16
No files found.
plugins/skproto.cpp
View file @
79e46b4d
...
...
@@ -38,12 +38,13 @@
#include "skproto.h"
void
SkyliveProtocol
::
startPlugin
()
{
std
::
cout
<<
"SkyliveProtocol initialized in thread "
<<
thread
()
<<
std
::
endl
;
SKMessage
::
SKMessage
prova
(
"ANTANI STA PROVA!!"
);
sendMessage
(
prova
);
handlers
.
registerHandler
((
QString
)
"connectTelescopes"
,
&
SkyliveProtocol
::
handle_connect
);
registerHandler
((
QString
)
"connectTelescopes"
,
&
SkyliveProtocol
::
handle_connect
);
}
...
...
@@ -62,3 +63,19 @@ void SkyliveProtocol::sendMessage(SKMessage::SKMessage msg)
emit
putMessage
(
msg
);
}
void
SkyliveProtocol
::
execute
(
SKMessage
::
SKMessage
&
msg
)
{
if
(
_handlers
.
contains
(
msg
.
handle
))
{
SKHandlerFunction
mf
=
_handlers
[
msg
.
handle
];
(
this
->*
mf
)(
msg
);
}
}
void
SkyliveProtocol
::
registerHandler
(
QString
type
,
SKHandlerFunction
handler
)
{
_handlers
[
type
]
=
handler
;
}
plugins/skproto.h
View file @
79e46b4d
...
...
@@ -34,9 +34,12 @@
*/
#include <QObject>
#include <QtPlugin>
#include <QHash>
#include "pluginsinterfaces.h"
#include "ipcmsg.h"
class
SkyliveProtocol
;
typedef
void
(
SkyliveProtocol
::*
SKHandlerFunction
)(
SKMessage
::
SKMessage
);
class
SkyliveProtocol
:
public
QObject
,
SkylivexPluginInterface
{
...
...
@@ -45,13 +48,18 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface
Q_INTERFACES
(
SkylivexPluginInterface
)
private
:
SKHandlers
::
SKHandlers
handlers
;
QHash
<
QString
,
SKHandlerFunction
>
_handlers
;
public
:
void
startPlugin
();
void
sendMessage
(
SKMessage
::
SKMessage
msg
);
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
execute
(
SKMessage
::
SKMessage
&
msg
);
void
handle_connect
(
SKMessage
::
SKMessage
msg
);
public
slots
:
void
receiveMessage
(
SKMessage
::
SKMessage
msg
);
signals
:
void
putMessage
(
SKMessage
::
SKMessage
msg
);
};
...
...
src/ipcmsg.cpp
View file @
79e46b4d
...
...
@@ -84,23 +84,3 @@ SKMessage::SKMessage(const SKMessage &other)
time
=
other
.
time
;
}
SKHandlers
::
SKHandlers
()
{
}
void
SKHandlers
::
execute
(
SKMessage
::
SKMessage
&
msg
)
{
//if(_handlers.contains(msg.handle))
// _handlers[msg.handle](msg);
}
void
SKHandlers
::
registerHandler
(
QString
type
,
SKHandlerFunction
handler
)
{
_handlers
[
type
]
=
handler
;
}
SKHandlers
::~
SKHandlers
()
{
}
src/ipcmsg.h
View file @
79e46b4d
...
...
@@ -64,20 +64,4 @@ class SKMessage
};
typedef
void
(
*
SKHandlerFunction
)(
SKMessage
::
SKMessage
);
class
SKHandlers
{
public
:
SKHandlers
();
~
SKHandlers
();
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
execute
(
SKMessage
::
SKMessage
&
msg
);
private
:
QHash
<
QString
,
SKHandlerFunction
>
_handlers
;
};
#endif
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