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
2e155e9b
Commit
2e155e9b
authored
Feb 24, 2013
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a plugin skeleton
parent
3093376b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
167 additions
and
0 deletions
+167
-0
plugin_skeleton.cpp
plugins/plugin_skeleton.cpp
+85
-0
plugin_skeleton.h
plugins/plugin_skeleton.h
+75
-0
plugin_skeleton.pro
plugins/plugin_skeleton.pro
+7
-0
No files found.
plugins/plugin_skeleton.cpp
0 → 100644
View file @
2e155e9b
/* ____ _ _ _ __ __
* / ___|| | ___ _| (_)_ _____\ \/ /
* \___ \| |/ / | | | | \ \ / / _ \\ /
* ___) | <| |_| | | |\ V / __// \ Remote Telescopes
* |____/|_|\_\\__, |_|_| \_/ \___/_/\_\ For the masses
* |___/
*
* Copyright (C) 2013 Franco (nextime) Lanza <nextime@nexlab.it>
* Copyright (C) 2013 Ivan Bellia <skylive@skylive.it>
*
* All rights reserved.
*
* This file is part of SkyliveX.
*
* SkyliveX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*
********************************************************************
*
* File:
*
* Purpose:
*
*/
#include "pluginsinterfaces.h"
#include "ipcmsg.h"
#include <iostream>
#include "plugin_skeleton.h"
void
SkylivePluginSkeleton
::
startPlugin
()
{
std
::
cout
<<
"SkylivePluginSkeleton initialized in thread "
<<
thread
()
<<
std
::
endl
;
registerHandler
((
QString
)
"something"
,
&
SkylivePluginSkeleton
::
handle_getlogin
);
}
void
SkylivePluginSkeleton
::
pluginKicked
()
{
}
void
SkylivePluginSkeleton
::
receiveMessage
(
SKMessage
msg
)
{
std
::
cout
<<
"SkylivePluginSkeleton msg received: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
if
(
_handlers
.
contains
(
msg
.
handle
)
&&
msg
.
sender
!=
SENDER
)
{
SKHandlerFunction
mf
=
_handlers
[
msg
.
handle
];
(
this
->*
mf
)(
msg
);
}
}
void
SkylivePluginSkeleton
::
sendMessage
(
SKMessage
msg
)
{
msg
.
sender
=
SENDER
;
emit
putMessage
(
msg
);
}
void
SkylivePluginSkeleton
::
registerHandler
(
QString
type
,
SKHandlerFunction
handler
)
{
_handlers
[
type
]
=
handler
;
}
void
SkylivePluginSkeleton
::
handle_something
(
SKMessage
msg
)
{
std
::
cout
<<
"Plugin Skeleton module handle something by "
<<
msg
.
sender
.
toStdString
()
<<
std
::
endl
;
SKMessage
smsg
(
"plugin_skeleton"
);
sendMessage
(
smsg
);
}
plugins/plugin_skeleton.h
0 → 100644
View file @
2e155e9b
/* ____ _ _ _ __ __
* / ___|| | ___ _| (_)_ _____\ \/ /
* \___ \| |/ / | | | | \ \ / / _ \\ /
* ___) | <| |_| | | |\ V / __// \ Remote Telescopes
* |____/|_|\_\\__, |_|_| \_/ \___/_/\_\ For the masses
* |___/
*
* Copyright (C) 2013 Franco (nextime) Lanza <nextime@nexlab.it>
* Copyright (C) 2013 Ivan Bellia <skylive@skylive.it>
*
* All rights reserved.
*
* This file is part of SkyliveX.
*
* SkyliveX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*
********************************************************************
*
* File:
*
* Purpose:
*
*/
#ifndef SKAUTH_H
#define SKAUTH_H
#define SENDER "plugin_skeleton"
#include <QObject>
#include <QHash>
#include <QString>
#include <QtPlugin>
#include "pluginsinterfaces.h"
#include "ipcmsg.h"
class
SkylivePluginSkeleton
;
typedef
void
(
SkylivePluginSkeleton
::*
SKHandlerFunction
)(
SKMessage
);
class
SkylivePluginSkeleton
:
public
QObject
,
SkylivexPluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA
(
IID
"com.skylivex.SkylivexPlugin/1.0"
FILE
"plugin_skeleton.json"
)
Q_INTERFACES
(
SkylivexPluginInterface
)
private
:
QHash
<
QString
,
SKHandlerFunction
>
_handlers
;
public
:
void
startPlugin
();
void
sendMessage
(
SKMessage
msg
);
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
handle_something
(
SKMessage
msg
);
public
slots
:
void
receiveMessage
(
SKMessage
msg
);
void
pluginKicked
();
signals
:
void
putMessage
(
SKMessage
msg
);
};
#endif
plugins/plugin_skeleton.pro
0 → 100644
View file @
2e155e9b
TEMPLATE
=
lib
SOURCES
=
plugin_skeleton
.
cpp
..
/
src
/
ipcmsg
.
cpp
CONFIG
+=
plugin
HEADERS
=
plugin_skeleton
.
h
..
/
src
/
ipcmsg
.
h
INCLUDEPATH
=
..
/
src
QT
+=
core
network
widgets
DESTDIR
=
..
/
build
/
plugins
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