Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
portabledsb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
App_Technologies
portabledsb
Commits
13d3fefe
Commit
13d3fefe
authored
Dec 13, 2015
by
gladish
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some helper stuff, DeviceMain
parent
96bba8f3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
9 deletions
+147
-9
Bridge/AllJoynHelper.cpp
Bridge/AllJoynHelper.cpp
+11
-4
Bridge/AllJoynHelper.h
Bridge/AllJoynHelper.h
+43
-1
Bridge/DeviceMain.cpp
Bridge/DeviceMain.cpp
+39
-0
Bridge/DeviceMain.h
Bridge/DeviceMain.h
+53
-0
Common/Variant.cpp
Common/Variant.cpp
+0
-4
Makefile
Makefile
+1
-0
No files found.
Bridge/AllJoynHelper.cpp
View file @
13d3fefe
#include "AllJoynHelper.h"
#include "DeviceMain.h"
QStatus
...
...
@@ -15,6 +16,9 @@ bridge::AllJoynHelper::SetMsgArg(IAdapterValue const& adapterValue, ajn::MsgArg&
switch
(
val
.
GetType
())
{
case
common
::
Variant
::
DataType
::
Invalid
:
break
;
case
common
::
Variant
::
DataType
::
Boolean
:
{
bool
b
=
val
.
ToBoolean
();
...
...
@@ -141,7 +145,12 @@ bridge::AllJoynHelper::SetMsgArg(IAdapterValue const& adapterValue, ajn::MsgArg&
QStatus
bridge
::
AllJoynHelper
::
SetMsgArgFromAdapterObject
(
IAdapterValue
const
&
adapterValue
,
ajn
::
MsgArg
&
msg
,
DeviceMain
*
deviceMain
)
{
return
ER_NOT_IMPLEMENTED
;
// TODO:
QStatus
st
=
ER_OK
;
common
::
Variant
const
&
val
=
adapterValue
.
GetData
();
// std::string path = deviceMain->GetBusObjectPath(adapterValue);
return
st
;
}
QStatus
...
...
@@ -186,9 +195,7 @@ bridge::AllJoynHelper::GetAdapterObject(IAdapterValue& adapterValue, ajn::MsgArg
QStatus
bridge
::
AllJoynHelper
::
GetSignature
(
common
::
Variant
::
DataType
type
,
std
::
string
&
sig
)
{
using
namespace
common
;
#define setSignature(T, S) case Variant::DataType::T: sig = S; break
#define setSignature(T, S) case common::Variant::DataType::T: sig = S; break
QStatus
status
=
ER_OK
;
switch
(
type
)
...
...
Bridge/AllJoynHelper.h
View file @
13d3fefe
...
...
@@ -40,10 +40,52 @@ namespace bridge
};
template
<
class
T
>
QStatus
AllJoynHelper
::
SetMsgArg
(
ajn
::
MsgArg
&
msg
Arg
,
std
::
string
const
&
sig
,
std
::
vector
<
T
>
const
&
arr
)
QStatus
AllJoynHelper
::
SetMsgArg
(
ajn
::
MsgArg
&
msg
,
std
::
string
const
&
sig
,
std
::
vector
<
T
>
const
&
arr
)
{
QStatus
st
=
ER_OK
;
if
(
!
arr
.
empty
())
{
st
=
msg
.
Set
(
sig
.
c_str
(),
arr
.
size
(),
&
arr
[
0
]);
msg
.
Stabilize
();
}
else
{
T
buff
[
1
];
buff
[
0
]
=
T
();
st
=
msg
.
Set
(
sig
.
c_str
(),
1
,
buff
);
msg
.
Stabilize
();
}
return
st
;
}
template
<
>
QStatus
AllJoynHelper
::
SetMsgArg
(
ajn
::
MsgArg
&
msg
,
std
::
string
const
&
sig
,
std
::
vector
<
std
::
string
>
const
&
arr
)
{
QStatus
st
=
ER_OK
;
if
(
!
arr
.
empty
())
{
int
n
=
static_cast
<
int
>
(
arr
.
size
());
typedef
char
const
*
value_type
;
value_type
*
p
=
new
value_type
[
n
];
for
(
int
i
=
0
;
i
<
n
;
++
i
)
p
[
i
]
=
arr
[
i
].
c_str
();
st
=
msg
.
Set
(
sig
.
c_str
(),
n
,
p
);
msg
.
Stabilize
();
}
else
{
st
=
msg
.
Set
(
sig
.
c_str
(),
1
,
""
);
msg
.
Stabilize
();
}
return
st
;
}
}
Bridge/DeviceMain.cpp
0 → 100644
View file @
13d3fefe
#include "DeviceMain.h"
bridge
::
DeviceMain
::
DeviceMain
()
:
m_indexForSignal
(
1
)
,
m_indexForMethod
(
1
)
,
m_registeredOnAllJoyn
(
false
)
{
}
bridge
::
DeviceMain
::~
DeviceMain
()
{
Shutdown
();
}
void
bridge
::
DeviceMain
::
Shutdown
()
{
}
QStatus
bridge
::
DeviceMain
::
Initialize
(
shared_ptr
<
BridgeDevice
>
const
&
parent
)
{
QStatus
st
=
ER_OK
;
return
st
;
}
bool
bridge
::
DeviceMain
::
IsMethodNameUnique
(
std
::
string
const
&
name
)
{
return
m_deviceMethods
.
find
(
name
)
!=
m_deviceMethods
.
end
();
}
bool
bridge
::
DeviceMain
::
IsSignalNameUnique
(
std
::
string
const
&
name
)
{
// TODO:
return
false
;
}
Bridge/DeviceMain.h
0 → 100644
View file @
13d3fefe
#ifndef __DEVICE_MAIN_H__
#define __DEVICE_MAIN_H__
#include "BridgeDevice.h"
#include <map>
#include <alljoyn/BusObject.h>
#include <alljoyn/InterfaceDescription.h>
namespace
bridge
{
class
DeviceMethod
;
class
DeviceSignal
;
class
DeviceMain
{
DeviceMain
();
virtual
~
DeviceMain
();
QStatus
Initialize
(
shared_ptr
<
BridgeDevice
>
const
&
parent
);
bool
IsMethodNameUnique
(
std
::
string
const
&
name
);
bool
IsSignalNameUnique
(
std
::
string
const
&
name
);
void
HandleSignal
(
IAdapterSignal
const
&
adapterSignal
);
inline
shared_ptr
<
ajn
::
BusObject
>
GetBusObject
()
const
{
return
m_busObject
;
}
inline
int
GetIndexForMethod
()
{
return
m_indexForMethod
++
;
}
inline
std
::
string
GetBusObjectPath
(
IAdapterProperty
const
&
prop
)
{
return
std
::
string
();
}
private:
void
Shutdown
();
private:
int
m_indexForSignal
;
int
m_indexForMethod
;
shared_ptr
<
ajn
::
BusObject
>
m_busObject
;
std
::
unique_ptr
<
ajn
::
InterfaceDescription
>
m_interfaceDescrtipion
;
std
::
string
m_busObjectPath
;
std
::
string
m_interfaceName
;
std
::
shared_ptr
<
BridgeDevice
>
m_parent
;
std
::
map
<
std
::
string
,
DeviceMethod
*
>
m_deviceMethods
;
std
::
map
<
std
::
string
,
DeviceSignal
*
>
m_deviceSignals
;
bool
m_registeredOnAllJoyn
;
};
}
#endif
Common/Variant.cpp
View file @
13d3fefe
#include "Variant.h"
namespace
{
}
common
::
Variant
::
Data
::
Data
()
{
Type
=
DataType
::
Invalid
;
...
...
Makefile
View file @
13d3fefe
...
...
@@ -6,6 +6,7 @@ SRCS=DeviceProviders/AllJoynProvider.cpp \
Bridge/BridgeConfig.cpp
\
Bridge/BridgeDevice.cpp
\
Bridge/ConfigManager.cpp
\
Bridge/DeviceMain.cpp
\
Common/Log.cpp
\
Common/Variant.cpp
\
Adapters/MockAdapter/MockAdapter.cpp
\
...
...
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