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
acbe35f5
Commit
acbe35f5
authored
Dec 09, 2015
by
gladish
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a stub for ZigBee adapter.
parent
c515fdd5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
270 additions
and
7 deletions
+270
-7
Adapters/ZigBeeAdapter/ZigBeeAdapter.cpp
Adapters/ZigBeeAdapter/ZigBeeAdapter.cpp
+137
-0
Adapters/ZigBeeAdapter/ZigBeeAdapter.h
Adapters/ZigBeeAdapter/ZigBeeAdapter.h
+100
-0
Makefile
Makefile
+9
-4
main.cpp
main.cpp
+24
-3
No files found.
Adapters/ZigBeeAdapter/ZigBeeAdapter.cpp
0 → 100644
View file @
acbe35f5
#include "Adapters/ZigBeeAdapter/ZigBeeAdapter.h"
namespace
{
std
::
string
const
kVendor
(
"Charlie Root"
);
std
::
string
const
kAdapterName
(
"ZigBee"
);
std
::
string
const
kVersion
(
"1.0"
);
std
::
string
const
kExposedPrefix
(
"com.allseen"
);
std
::
string
const
kExposedAppName
(
"The ZigBee Adapter"
);
std
::
string
const
kExposedGuid
(
"B8D50823-9F64-4110-AA0C-3CB3D17B73F2"
);
}
AdapterLib
::
ZigBeeAdapter
::
ZigBeeAdapter
()
{
}
AdapterLib
::
ZigBeeAdapter
::~
ZigBeeAdapter
()
{
}
std
::
string
AdapterLib
::
ZigBeeAdapter
::
GetVendor
()
{
return
kVendor
;
}
std
::
string
AdapterLib
::
ZigBeeAdapter
::
GetAdapterName
()
{
return
kAdapterName
;
}
std
::
string
AdapterLib
::
ZigBeeAdapter
::
GetVersion
()
{
return
kVersion
;
}
std
::
string
AdapterLib
::
ZigBeeAdapter
::
GetExposedAdapterPrefix
()
{
return
kExposedPrefix
;
}
std
::
string
AdapterLib
::
ZigBeeAdapter
::
GetExposedApplicationName
()
{
return
kExposedAppName
;
}
std
::
string
AdapterLib
::
ZigBeeAdapter
::
GetExposedApplicationGuid
()
{
return
kExposedGuid
;
}
Bridge
::
AdapterSignalVector
AdapterLib
::
ZigBeeAdapter
::
GetSignals
()
{
// TODO: wouldn't this list be per device?
return
Bridge
::
AdapterSignalVector
();
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
Initialize
()
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
Shutdown
()
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
EnumDevices
(
Bridge
::
EnumDeviceOptions
opts
,
Bridge
::
AdapterDeviceVector
&
deviceList
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
)
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
GetProperty
(
shared_ptr
<
Bridge
::
IAdapterProperty
>&
prop
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
)
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
SetProperty
(
shared_ptr
<
Bridge
::
IAdapterProperty
>
const
&
prop
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
)
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
GetPropertyValue
(
shared_ptr
<
Bridge
::
IAdapterProperty
>
const
&
prop
,
std
::
string
const
&
attributeName
,
shared_ptr
<
Bridge
::
IAdapterValue
>&
value
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
)
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
SetPropertyValue
(
shared_ptr
<
Bridge
::
IAdapterProperty
>
const
&
prop
,
shared_ptr
<
Bridge
::
IAdapterValue
>
const
&
value
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
)
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
CallMethod
(
shared_ptr
<
Bridge
::
IAdapterMethod
>&
method
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
)
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
RegisterSignalListener
(
std
::
string
const
&
signalName
,
shared_ptr
<
Bridge
::
IAdapterSignalListener
>
const
&
listener
,
void
*
argp
,
Bridge
::
IAdapter
::
RegistrationHandle
&
handle
)
{
return
-
1
;
}
int32_t
AdapterLib
::
ZigBeeAdapter
::
UnregisterSignalListener
(
Bridge
::
IAdapter
::
RegistrationHandle
const
&
h
)
{
return
-
1
;
}
Adapters/ZigBeeAdapter/ZigBeeAdapter.h
0 → 100644
View file @
acbe35f5
#pragma once
#include "Bridge/IAdapter.h"
namespace
AdapterLib
{
class
ZigBeeAdapter
;
class
ZigBeeAdapterDevice
;
class
ZigBeeAdapterValue
;
class
ZigBeeAdapterMethod
:
public
Bridge
::
IAdapterMethod
{
public:
ZigBeeAdapterMethod
(
weak_ptr
<
ZigBeeAdapterDevice
>
const
&
target
,
std
::
string
const
&
name
);
public:
virtual
std
::
string
GetName
()
const
;
virtual
std
::
string
GetDescritpion
()
const
;
virtual
Bridge
::
AdapterValueVector
const
&
GetInputParams
()
const
;
virtual
Bridge
::
AdapterValueVector
const
&
GetOutputParams
()
const
;
virtual
void
SetInputParams
(
Bridge
::
AdapterValueVector
const
&
params
);
virtual
void
SetOutputParams
(
Bridge
::
AdapterValueVector
const
&
params
);
void
AddInputParam
(
shared_ptr
<
Bridge
::
IAdapterValue
>
const
&
p
);
void
AddOutputParam
(
shared_ptr
<
Bridge
::
IAdapterValue
>
const
&
p
);
virtual
int32_t
GetResult
();
void
SetResult
(
int32_t
st
);
private:
shared_ptr
<
ZigBeeAdapterDevice
>
GetParent
()
const
{
return
m_parent
.
lock
();
}
private:
std
::
string
m_name
;
std
::
string
m_description
;
Bridge
::
AdapterValueVector
m_inputParams
;
Bridge
::
AdapterValueVector
m_outputParams
;
weak_ptr
<
ZigBeeAdapterDevice
>
m_parent
;
int32_t
m_result
;
};
class
ZigBeeAdapter
:
public
Bridge
::
IAdapter
{
public:
ZigBeeAdapter
();
virtual
~
ZigBeeAdapter
();
virtual
std
::
string
GetVendor
();
virtual
std
::
string
GetAdapterName
();
virtual
std
::
string
GetVersion
();
virtual
std
::
string
GetExposedAdapterPrefix
();
virtual
std
::
string
GetExposedApplicationName
();
virtual
std
::
string
GetExposedApplicationGuid
();
virtual
Bridge
::
AdapterSignalVector
GetSignals
();
virtual
int32_t
Initialize
();
virtual
int32_t
Shutdown
();
virtual
int32_t
EnumDevices
(
Bridge
::
EnumDeviceOptions
opts
,
Bridge
::
AdapterDeviceVector
&
deviceList
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
);
virtual
int32_t
GetProperty
(
shared_ptr
<
Bridge
::
IAdapterProperty
>&
prop
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
);
virtual
int32_t
SetProperty
(
shared_ptr
<
Bridge
::
IAdapterProperty
>
const
&
prop
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
);
virtual
int32_t
GetPropertyValue
(
shared_ptr
<
Bridge
::
IAdapterProperty
>
const
&
prop
,
std
::
string
const
&
attributeName
,
shared_ptr
<
Bridge
::
IAdapterValue
>&
value
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
);
virtual
int32_t
SetPropertyValue
(
shared_ptr
<
Bridge
::
IAdapterProperty
>
const
&
prop
,
shared_ptr
<
Bridge
::
IAdapterValue
>
const
&
value
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
);
virtual
int32_t
CallMethod
(
shared_ptr
<
Bridge
::
IAdapterMethod
>&
method
,
shared_ptr
<
Bridge
::
IAdapterIoRequest
>*
req
);
virtual
int32_t
RegisterSignalListener
(
std
::
string
const
&
signalName
,
shared_ptr
<
Bridge
::
IAdapterSignalListener
>
const
&
listener
,
void
*
argp
,
Bridge
::
IAdapter
::
RegistrationHandle
&
handle
);
virtual
int32_t
UnregisterSignalListener
(
Bridge
::
IAdapter
::
RegistrationHandle
const
&
h
);
};
}
Makefile
View file @
acbe35f5
...
...
@@ -9,22 +9,27 @@ SRCS=DeviceProviders/AllJoynProvider.cpp \
Adapters/MockAdapter/MockAdapter.cpp
\
Adapters/MockAdapter/MockDevices.cpp
\
Adapters/MockAdapter/MockAdapterDevice.cpp
\
Adapters/ZigBeeAdapter/ZigBeeAdapter.cpp
\
main.cpp
LIBXML_INC
=
/usr/include/libxml2
#ALLJOYN_INSTALL_DIR=/Users/jgladi200/Work/alljoyn/alljoyn-15.04.00
-src/build/darwin/x86/debug/dist/cpp
ALLJOYN_INSTALL_DIR
=
/home/gladish/work/alljoyn-15.09.00-src/build/linux/x86_64/debug/dist/cpp/
ALLJOYN_INSTALL_DIR
=
/Users/jgladi200/Work/alljoyn/alljoyn-15.09.00a
-src/build/darwin/x86/debug/dist/cpp
#
ALLJOYN_INSTALL_DIR=/home/gladish/work/alljoyn-15.09.00-src/build/linux/x86_64/debug/dist/cpp/
CXXFLAGS
=
-D
QCC_OS_GROUP_POSIX
-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-deprecated-declarations
-g
-std
=
c++0x
-I
.
-I
$(ALLJOYN_INSTALL_DIR)
/inc
-I
$(LIBXML_INC)
LDFLAGS
=
-L
$(ALLJOYN_INSTALL_DIR)
/lib
-lalljoyn
-lcrypto
-lxml2
-pthread
-luuid
CXXFLAGS
+=
-Wno-ignored-qualifiers
LDFLAGS
=
-L
$(ALLJOYN_INSTALL_DIR)
/lib
-lalljoyn
-lcrypto
-lxml2
DEV_PROVIDER_OBJS
=
$(
patsubst
%.cpp, %.o,
$(SRCS)
)
OBJS
=
$(DEV_PROVIDER_OBJS)
all
:
moc-adapter
clean
:
$(RM)
moc-adapter
*
.o DeviceProviders/
*
.o Bridge/
*
.o Common/
*
.o Adapters/MockAdapter/
*
.o
$(RM)
moc-adapter
*
.o DeviceProviders/
*
.o Bridge/
*
.o Common/
*
.o Adapters/MockAdapter/
*
.o
\
ZigBeeAdapter/
*
.o
moc-adapter
:
$(OBJS)
$(CXX)
-o
$@
$^
$(LDFLAGS)
...
...
main.cpp
View file @
acbe35f5
...
...
@@ -5,6 +5,7 @@
#include "Adapters/MockAdapter/MockAdapter.h"
#include "Common/Variant.h"
#include <iostream>
namespace
{
...
...
@@ -45,10 +46,9 @@ int main(int /*argc*/, char* /*argv*/ [])
QStatus
st
=
ER_OK
;
// TODO: should be unique_ptr and ownership give to bridge
shared_ptr
<
Bridge
::
IAdapter
>
adapter
(
new
AdapterLib
::
MockAdapter
(
));
shared_ptr
<
Bridge
::
DeviceSystemBridge
>
bridge
(
new
Bridge
::
DeviceSystemBridge
(
shared_ptr
<
Bridge
::
IAdapter
>
(
new
AdapterLib
::
MockAdapter
())
));
shared_ptr
<
Bridge
::
DeviceSystemBridge
>
bridge
(
new
Bridge
::
DeviceSystemBridge
(
adapter
));
st
=
bridge
->
Initialize
();
if
(
st
!=
ER_OK
)
{
...
...
@@ -56,6 +56,27 @@ int main(int /*argc*/, char* /*argv*/ [])
return
1
;
}
shared_ptr
<
Bridge
::
IAdapter
>
adapter
=
bridge
->
GetAdapter
();
Bridge
::
AdapterDeviceVector
deviceList
;
shared_ptr
<
Bridge
::
IAdapterIoRequest
>
req
;
// TODO: do we need enums for this?
int32_t
ret
=
adapter
->
EnumDevices
(
Bridge
::
EnumDeviceOptions
::
ForceRefresh
,
deviceList
,
&
req
);
if
(
ret
!=
0
)
{
std
::
cout
<<
"EnumDevices:"
<<
ret
<<
std
::
endl
;
exit
(
0
);
}
for
(
auto
const
&
d
:
deviceList
)
{
std
::
cout
<<
"Device"
<<
std
::
endl
;
std
::
cout
<<
"
\t
Name:"
<<
d
->
GetName
()
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
;
}
return
0
;
}
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