├── .cproject
├── .gitignore
├── .project
├── .vscode
├── c_cpp_properties.json
└── settings.json
├── LICENSE
├── Makefile
├── README.md
└── src
├── HouseholdSolarPowerGeneration
└── SampleExample.cpp
├── openecho
├── DeviceObject.cpp
├── DeviceObject.h
├── Echo.cpp
├── Echo.h
├── EchoFrame.cpp
├── EchoFrame.h
├── EchoNode.cpp
├── EchoNode.h
├── EchoObject.cpp
├── EchoObject.h
├── EchoProperty.cpp
├── EchoProperty.h
├── EchoProtocol.cpp
├── EchoProtocol.h
├── EchoSocket.cpp
├── EchoSocket.h
├── EchoStorage.cpp
├── EchoStorage.h
├── EchoUDPProtocol.cpp
├── EchoUDPProtocol.h
├── EchoUtils.cpp
├── EchoUtils.h
├── HouseholdSolarPowerGeneration.cpp
├── HouseholdSolarPowerGeneration.h
├── NodeProfile.cpp
├── NodeProfile.h
├── OpenECHO.h
├── ProfileObject.cpp
├── ProfileObject.h
├── SmartElectricEnergyMeter.cpp
└── SmartElectricEnergyMeter.h
├── tutorial1
└── main.cpp
├── tutorial2a
└── main.cpp
└── tutorial4
├── main
├── main.cpp
└── man.cpp
/.cproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | ._*
3 | Thumbs.db
4 | *.class
5 | *.dex
6 | /bin/
7 | /gen/
8 | /Debug/
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | OpenECHO
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.core.ccnature
24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/.vscode/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "includePath": [
6 | "${workspaceFolder}/**"
7 | ],
8 | "defines": [],
9 | "compilerPath": "/usr/bin/gcc",
10 | "cStandard": "c17",
11 | "cppStandard": "gnu++17",
12 | "intelliSenseMode": "linux-gcc-arm"
13 | }
14 | ],
15 | "version": 4
16 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.associations": {
3 | "array": "cpp",
4 | "atomic": "cpp",
5 | "bit": "cpp",
6 | "*.tcc": "cpp",
7 | "cctype": "cpp",
8 | "clocale": "cpp",
9 | "cmath": "cpp",
10 | "compare": "cpp",
11 | "concepts": "cpp",
12 | "cstdarg": "cpp",
13 | "cstddef": "cpp",
14 | "cstdint": "cpp",
15 | "cstdio": "cpp",
16 | "cstdlib": "cpp",
17 | "cstring": "cpp",
18 | "cwchar": "cpp",
19 | "cwctype": "cpp",
20 | "deque": "cpp",
21 | "list": "cpp",
22 | "map": "cpp",
23 | "set": "cpp",
24 | "string": "cpp",
25 | "unordered_map": "cpp",
26 | "vector": "cpp",
27 | "exception": "cpp",
28 | "algorithm": "cpp",
29 | "functional": "cpp",
30 | "iterator": "cpp",
31 | "memory": "cpp",
32 | "memory_resource": "cpp",
33 | "numeric": "cpp",
34 | "random": "cpp",
35 | "string_view": "cpp",
36 | "system_error": "cpp",
37 | "tuple": "cpp",
38 | "type_traits": "cpp",
39 | "utility": "cpp",
40 | "initializer_list": "cpp",
41 | "iosfwd": "cpp",
42 | "iostream": "cpp",
43 | "istream": "cpp",
44 | "limits": "cpp",
45 | "new": "cpp",
46 | "numbers": "cpp",
47 | "ostream": "cpp",
48 | "stdexcept": "cpp",
49 | "streambuf": "cpp",
50 | "cinttypes": "cpp",
51 | "typeinfo": "cpp"
52 | }
53 | }
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # This is makefile for GNU Make and linux.
2 | # confirm with g++ 4.8.x
3 | CPP = g++
4 | CFLAGS = -O2 -std=c++11 -Wall
5 | LDFLAGS =
6 | LIBS = -lpthread
7 | CPP_FILES = src/OpenECHO.cpp $(wildcard src/echo/*.cpp)
8 | # TODO: fix this.
9 | OBJ_DIR = obj
10 | OBJS = $(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))
11 |
12 | PROGRAM = OpenECHOForCpp
13 |
14 | all: $(PROGRAM)
15 |
16 | $(PROGRAM): directories $(OBJS)
17 | $(CPP) $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS) -o $(PROGRAM)
18 |
19 | obj/%.o: src/%.cpp
20 | $(CPP) $(CFLAGS) -c -o $@ $<
21 |
22 | obj/%.o: src/echo/%.cpp
23 | $(CPP) $(CFLAGS) -c -o $@ $<
24 |
25 | clean:;
26 | find . -type f -name "*.o" | xargs rm -f
27 | rm -r obj
28 |
29 | PHONY: check-syntax
30 | check-syntax:
31 | $(CPP) -Wall -fsyntax-only $(LDFLAGS) $(CFLAGS) $(LIBS) $(CHK_SOURCES)
32 |
33 | PHONY: directories
34 | directories: $(OBJ_DIR)
35 |
36 | $(OBJ_DIR):
37 | mkdir $(OBJ_DIR)
38 |
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | OpenECHO-cpp
2 | ============
3 |
4 | C++ Implementation of ECHONET Lite
5 |
6 | ###概要
7 |
8 | OpenECHO-cppは、家電やセンサーデバイスなど、スマートハウスで用いられる機器のための通信プロトコルである[ECHONET Lite][]をC++で実装したドライバライブラリです。
9 | 同Java版の[OpenECHO][]と兄弟的なライブラリになりますが、言語以外にもいくつかの相違点があります。一番大きな違いは、C++版には機器オブジェクトがなく、使う機器のクラスを自分で生成する必要があるということです。面倒さと引き換えに、サイズの小ささを獲得しています。
10 |
11 |
12 | 現在、ECHONET Lite対応機器としてECHONETコンソーシアムに認証された機器のリストが[こちらにあります](http://www.echonet.gr.jp/kikaku_ninsyo/list_lite/equip_srch)。2014年4月時点ですでに160種類以上の機器が受理されている模様です。
13 |
14 | ※ただし、あくまでコンソーシアムが認証した機器のリストであって、すでに市場に出回っているかどうかはわかりません。OpenECHOもこれら全ての機器の動作を保証するものではありません。というか、どの機器の動作も保証いたしません。
15 |
16 | Java版を用いて実装されたAndroidホームサーバー「Kadecot」による[動作実験ビデオ](http://www.youtube.com/watch?v=SwpHSAvoV9I)があります。
17 |
18 | ###ライセンス
19 | 本ソフトウェアの著作権は[株式会社ソニーコンピュータサイエンス研究所][]が保持しており、GPLで配布されています。ライセンスに従い,自由にご利用ください。
20 |
21 | ###用いているデータベース
22 | 本ライブラリの作成には、弊社から公開されている[ECHONET Liteデータベース][]を用いています。
23 | [ECHONET Liteデータベース][]の最新仕様へのアップデート・やフィードバックも随時募集しています。データベースのライセンスはパブリックドメインですのでぜひご協力ください。
24 |
25 | ###互換性と動作レポート
26 | OpenECHO-cppは標準的なC++の機能だけで実装されておりますが、必ずどこでも動くわけではありません。動作チェックは行っておらず動く保証はありません。ご了承ください。
27 |
28 | [ECHONET Lite]: http://www.echonet.gr.jp/ "ECHONET Lite"
29 | [OpenECHO]: https://github.com/SonyCSL/OpenECHO "OpenECHO"
30 | [株式会社ソニーコンピュータサイエンス研究所]: http://www.sonycsl.co.jp/ "株式会社ソニーコンピュータサイエンス研究所"
31 | [MITライセンス]: http://opensource.org/licenses/mit-license.php "MITライセンス"
32 | [Processing]: http://processing.org "Processing"
33 | [神奈川工科大学スマートハウス研究センター]: http://smarthouse-center.org/sdk/ "神奈川工科大学スマートハウス研究センター"
34 | [ECHONET Liteデータベース]: https://github.com/SonyCSL/ECHONETLite-ObjectDatabase "ECHONET Liteデータベース"
35 |
--------------------------------------------------------------------------------
/src/HouseholdSolarPowerGeneration/SampleExample.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "../openecho/OpenECHO.h"
4 | #include "../openecho/HouseholdSolarPowerGeneration.h"
5 | #include "../openecho/EchoProperty.h"
6 |
7 | using namespace std;
8 | using namespace sonycsl_openecho;
9 | class DefaultNodeProfile : public NodeProfile
10 | {
11 |
12 | public:
13 | DefaultNodeProfile() : NodeProfile() {}
14 | virtual ~DefaultNodeProfile() {}
15 |
16 | protected:
17 | virtual shared_ptr> getManufacturerCode()
18 | {
19 | return shared_ptr>();
20 | }
21 | virtual shared_ptr> getOperatingStatus()
22 | {
23 | return shared_ptr>();
24 | }
25 | virtual shared_ptr> getIdentificationNumber()
26 | {
27 | return shared_ptr>();
28 | }
29 | };
30 | class Household : public HouseholdSolarPowerGeneration
31 | {
32 | protected:
33 | shared_ptr> mStatus;
34 | shared_ptr> mLocation;
35 | shared_ptr> mFaultStatus;
36 | shared_ptr> mManufacturerCode;
37 | static const unsigned char EPC_MEASURED_INSTANTANEOUS_ELECTRICITY_GENERATION = 0xE0;
38 | static const unsigned char EPC_MEASURED_CUMULATIVE_AMOUT_OF_ELECTRICITY_GENERATION = 0xE1;
39 |
40 | public:
41 | Household() : HouseholdSolarPowerGeneration()
42 | {
43 | mStatus = shared_ptr>(new vector());
44 | mStatus.get()->push_back(0x30);
45 | mLocation = shared_ptr>(new vector());
46 | mLocation.get()->push_back(0x00);
47 | mFaultStatus = shared_ptr>(new vector());
48 | mFaultStatus.get()->push_back(0x42);
49 | mManufacturerCode = shared_ptr>(new vector());
50 | mManufacturerCode.get()->push_back(0x00);
51 | mManufacturerCode.get()->push_back(0x00);
52 | mManufacturerCode.get()->push_back(0x00);
53 | }
54 | virtual ~Household() {}
55 | virtual unsigned short getEchoClassCode()
56 | {
57 | return 0x0279;
58 | }
59 |
60 | protected:
61 | virtual void setupPropertyMaps()
62 | {
63 | HouseholdSolarPowerGeneration::setupPropertyMaps();
64 | addSetProperty(EPC_OPERATION_STATUS);
65 | addGetProperty(EPC_MEASURED_INSTANTANEOUS_ELECTRICITY_GENERATION);
66 | addGetProperty(EPC_MEASURED_CUMULATIVE_AMOUT_OF_ELECTRICITY_GENERATION);
67 | }
68 | virtual bool setProperty(EchoProperty& property) {
69 |
70 | bool success = DeviceObject::setProperty(property);
71 | if(success) return true;
72 |
73 | switch(property.epc) {
74 | default : return false;
75 | }
76 | }
77 |
78 | virtual std::shared_ptr> getProperty(
79 | unsigned char epc)
80 | {
81 |
82 | std::shared_ptr> edt = HouseholdSolarPowerGeneration::getProperty(epc);
83 | if (edt.get() != nullptr)
84 | return edt;
85 |
86 | switch (epc)
87 | {
88 | case EPC_MEASURED_INSTANTANEOUS_ELECTRICITY_GENERATION:
89 | return getMeasuredInstantaneousAmountOfElectricityGenerated();
90 | case EPC_MEASURED_CUMULATIVE_AMOUT_OF_ELECTRICITY_GENERATION:
91 | return getMeasuredCumulativeAmountOfElectricityGenerated();
92 | default:
93 | return std::shared_ptr>();
94 | }
95 | }
96 |
97 | virtual shared_ptr> getMeasuredInstantaneousAmountOfElectricityGenerated()
98 | {
99 | cout << "getMeasuredInstantaneousAmountOfElectricityGenerated function call" << endl;
100 | return NULL;
101 | }
102 | virtual shared_ptr> getMeasuredCumulativeAmountOfElectricityGenerated()
103 | {
104 | cout << "getMeasuredCumulativeAmountOfElectricityGenerated function call" << endl;
105 |
106 | return NULL;
107 | }
108 |
109 | virtual bool isValidProperty(EchoProperty &property)
110 | {
111 |
112 | bool valid = HouseholdSolarPowerGeneration::isValidProperty(property);
113 | if (valid)
114 | return true;
115 |
116 | switch (property.epc)
117 | {
118 | case EPC_MEASURED_INSTANTANEOUS_ELECTRICITY_GENERATION:
119 | return isValidMeasuredInstantaneousAmountOfElectricityGenerated(property.edt);
120 | case EPC_MEASURED_CUMULATIVE_AMOUT_OF_ELECTRICITY_GENERATION:
121 | return isValidMeasuredCumulativeAmountOfElectricityGenerated(property.edt);
122 | default:
123 | return false;
124 | }
125 | }
126 | bool setOperationStatus(vector &edt)
127 | {
128 | (*(mStatus.get()))[0] = edt.at(0);
129 | if (mStatus.get()->at(0) == 0x30)
130 | {
131 | cout << "ON" << endl;
132 | }
133 | else
134 | {
135 | cout << "OFF" << endl;
136 | }
137 | HouseholdSolarPowerGeneration::inform().reqInformOperationStatus().send();
138 | return true;
139 | }
140 | virtual shared_ptr> getOperationStatus()
141 | {
142 | return mStatus;
143 | }
144 | virtual bool setInstallationLocation(vector &edt)
145 | {
146 | return false;
147 | }
148 | virtual shared_ptr> getInstallationLocation()
149 | {
150 | return mLocation;
151 | }
152 | virtual shared_ptr> getFaultStatus()
153 | {
154 | return mFaultStatus;
155 | }
156 | virtual shared_ptr> getManufacturerCode()
157 | {
158 | return mManufacturerCode;
159 | }
160 | };
161 |
162 | int main()
163 | {
164 |
165 | shared_ptr profile(new DefaultNodeProfile());
166 | vector> devices;
167 | devices.push_back(shared_ptr(new Household()));
168 |
169 | // Echo::addEventListener(std::shared_ptr(new Echo::Logger()));
170 |
171 | Echo::start(profile, devices);
172 |
173 | while (true)
174 | {
175 | NodeProfile::Getter(NodeProfile::ECHO_CLASS_CODE, NodeProfile::INSTANCE_CODE, EchoSocket::MULTICAST_ADDRESS).reqGetSelfNodeInstanceListS().send();
176 |
177 | sleep(100);
178 | }
179 |
180 | return 0;
181 | }
--------------------------------------------------------------------------------
/src/openecho/DeviceObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * DeviceObject.h
3 | *
4 | * Created on: 2013/10/29
5 | * Author: Fumiaki
6 | */
7 |
8 | #ifndef DEVICEOBJECT_H_
9 | #define DEVICEOBJECT_H_
10 |
11 | #include "EchoObject.h"
12 |
13 | namespace sonycsl_openecho {
14 |
15 | class DeviceObject: public EchoObject {
16 | public:
17 | class Receiver;
18 | class Setter;
19 | class Getter;
20 | class Informer;
21 | class InformerC;
22 | class Proxy;
23 | public:
24 | static const unsigned char EPC_OPERATION_STATUS;
25 | static const unsigned char EPC_INSTALLATION_LOCATION;
26 | static const unsigned char EPC_STANDARD_VERSION_INFORMATION;
27 | static const unsigned char EPC_IDENTIFICATION_NUMBER;
28 | static const unsigned char EPC_MEASURED_INSTANTANEOUS_POWER_CONSUMPTION;
29 | static const unsigned char EPC_MEASURED_CUMULATIVE_POWER_CONSUMPTION;
30 | static const unsigned char EPC_MANUFACTURERS_FAULT_CODE;
31 | static const unsigned char EPC_CURRENT_LIMIT_SETTING;
32 | static const unsigned char EPC_FAULT_STATUS;
33 | static const unsigned char EPC_FAULT_DESCRIPTION;
34 | static const unsigned char EPC_MANUFACTURER_CODE;
35 | static const unsigned char EPC_BUSINESS_FACILITY_CODE;
36 | static const unsigned char EPC_PRODUCT_CODE;
37 | static const unsigned char EPC_PRODUCTION_NUMBER;
38 | static const unsigned char EPC_PRODUCTION_DATE;
39 | static const unsigned char EPC_POWER_SAVING_OPERATION_SETTING;
40 | static const unsigned char EPC_REMOTE_CONTROL_SETTING;
41 | static const unsigned char EPC_CURRENT_TIME_SETTING;
42 | static const unsigned char EPC_CURRENT_DATE_SETTING;
43 | static const unsigned char EPC_POWER_LIMIT_SETTING;
44 | static const unsigned char EPC_CUMULATIVE_OPERATING_TIME;
45 | static const unsigned char EPC_STATUS_CHANGE_ANNOUNCEMENT_PROPERTY_MAP;
46 | static const unsigned char EPC_SET_PROPERTY_MAP;
47 | static const unsigned char EPC_GET_PROPERTY_MAP;
48 |
49 | protected:
50 | unsigned char mEchoInstanceCode;
51 | std::shared_ptr > mStandardVersionInformation;
52 | public:
53 | DeviceObject();
54 | virtual ~DeviceObject();
55 |
56 | public:
57 | virtual unsigned char getInstanceCode();
58 |
59 | virtual void onNew(std::shared_ptr eoj);
60 |
61 | virtual void allocateSelfDeviceInstanceCode();
62 |
63 | virtual bool setProperty(EchoProperty& property);
64 | virtual std::shared_ptr > getProperty(unsigned char epc);
65 | virtual bool isValidProperty(EchoProperty& property);
66 |
67 | DeviceObject::Setter set();
68 | DeviceObject::Setter set(bool responseRequired);
69 | DeviceObject::Getter get();
70 | DeviceObject::Informer inform();
71 |
72 | protected:
73 | DeviceObject::Informer inform(bool multicast);
74 | DeviceObject::InformerC informC(std::string address);
75 |
76 | virtual void setupPropertyMaps();
77 |
78 | virtual bool setOperationStatus(std::vector& edt);
79 | virtual std::shared_ptr > getOperationStatus() = 0;
80 | virtual bool isValidOperationStatus(std::vector& edt);
81 | virtual bool setInstallationLocation(std::vector& edt) = 0;
82 | virtual std::shared_ptr > getInstallationLocation() = 0;
83 | virtual bool isValidInstallationLocation(std::vector& edt);
84 | virtual std::shared_ptr > getStandardVersionInformation();
85 | virtual bool isValidStandardVersionInformation(std::vector& edt);
86 | virtual std::shared_ptr > getIdentificationNumber();
87 | virtual bool isValidIdentificationNumber(std::vector& edt);
88 | virtual std::shared_ptr > getMeasuredInstantaneousPowerConsumption();
89 | virtual bool isValidMeasuredInstantaneousPowerConsumption(std::vector& edt);
90 | virtual std::shared_ptr > getMeasuredCumulativePowerConsumption();
91 | virtual bool isValidMeasuredCumulativePowerConsumption(std::vector& edt);
92 | virtual std::shared_ptr > getManufacturersFaultCode();
93 | virtual bool isValidManufacturersFaultCode(std::vector& edt);
94 | virtual bool setCurrentLimitSetting(std::vector& edt);
95 | virtual std::shared_ptr > getCurrentLimitSetting();
96 | virtual bool isValidCurrentLimitSetting(std::vector& edt);
97 | virtual std::shared_ptr > getFaultStatus() = 0;
98 | virtual bool isValidFaultStatus(std::vector& edt);
99 | virtual std::shared_ptr > getFaultDescription();
100 | virtual bool isValidFaultDescription(std::vector& edt);
101 | virtual std::shared_ptr > getManufacturerCode() = 0;
102 | virtual bool isValidManufacturerCode(std::vector& edt);
103 | virtual std::shared_ptr > getBusinessFacilityCode();
104 | virtual bool isValidBusinessFacilityCode(std::vector& edt);
105 | virtual std::shared_ptr > getProductCode();
106 | virtual bool isValidProductCode(std::vector& edt);
107 | virtual std::shared_ptr > getProductionNumber();
108 | virtual bool isValidProductionNumber(std::vector& edt);
109 | virtual std::shared_ptr > getProductionDate();
110 | virtual bool isValidProductionDate(std::vector& edt);
111 | virtual bool setPowerSavingOperationSetting(std::vector& edt);
112 | virtual std::shared_ptr > getPowerSavingOperationSetting();
113 | virtual bool isValidPowerSavingOperationSetting(std::vector& edt);
114 | virtual bool setRemoteControlSetting(std::vector& edt);
115 | virtual std::shared_ptr > getRemoteControlSetting();
116 | virtual bool isValidRemoteControlSetting(std::vector& edt);
117 | virtual bool setCurrentTimeSetting(std::vector& edt);
118 | virtual std::shared_ptr > getCurrentTimeSetting();
119 | virtual bool isValidCurrentTimeSetting(std::vector& edt);
120 | virtual bool setCurrentDateSetting(std::vector& edt);
121 | virtual std::shared_ptr > getCurrentDateSetting();
122 | virtual bool isValidCurrentDateSetting(std::vector& edt);
123 | virtual bool setPowerLimitSetting(std::vector& edt);
124 | virtual std::shared_ptr > getPowerLimitSetting();
125 | virtual bool isValidPowerLimitSetting(std::vector& edt);
126 | virtual std::shared_ptr > getCumulativeOperatingTime();
127 | virtual bool isValidCumulativeOperatingTime(std::vector& edt);
128 | virtual std::shared_ptr > getStatusChangeAnnouncementPropertyMap();
129 | virtual bool isValidStatusChangeAnnouncementPropertyMap(std::vector& edt);
130 | virtual std::shared_ptr > getSetPropertyMap();
131 | virtual bool isValidSetPropertyMap(std::vector& edt);
132 | virtual std::shared_ptr > getGetPropertyMap();
133 | virtual bool isValidGetPropertyMap(std::vector& edt);
134 |
135 | public:
136 | class Receiver : public EchoObject::Receiver {
137 | public:
138 | Receiver();
139 | virtual ~Receiver();
140 | protected:
141 | virtual bool onSetProperty(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
142 | virtual bool onGetProperty(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
143 | virtual bool onInformProperty(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property);
144 |
145 | virtual void onSetOperationStatus(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
146 | virtual void onSetInstallationLocation(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
147 | virtual void onSetCurrentLimitSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
148 | virtual void onSetPowerSavingOperationSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
149 | virtual void onSetRemoteControlSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
150 | virtual void onSetCurrentTimeSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
151 | virtual void onSetCurrentDateSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
152 | virtual void onSetPowerLimitSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
153 |
154 | virtual void onGetOperationStatus(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
155 | virtual void onGetInstallationLocation(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
156 | virtual void onGetStandardVersionInformation(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
157 | virtual void onGetIdentificationNumber(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
158 | virtual void onGetMeasuredInstantaneousPowerConsumption(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
159 | virtual void onGetMeasuredCumulativePowerConsumption(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
160 | virtual void onGetManufacturersFaultCode(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
161 | virtual void onGetCurrentLimitSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
162 | virtual void onGetFaultStatus(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
163 | virtual void onGetFaultDescription(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
164 | virtual void onGetManufacturerCode(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
165 | virtual void onGetBusinessFacilityCode(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
166 | virtual void onGetProductCode(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
167 | virtual void onGetProductionNumber(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
168 | virtual void onGetProductionDate(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
169 | virtual void onGetPowerSavingOperationSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
170 | virtual void onGetRemoteControlSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
171 | virtual void onGetCurrentTimeSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
172 | virtual void onGetCurrentDateSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
173 | virtual void onGetPowerLimitSetting(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
174 | virtual void onGetCumulativeOperatingTime(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
175 | virtual void onGetStatusChangeAnnouncementPropertyMap(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
176 | virtual void onGetSetPropertyMap(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
177 | virtual void onGetGetPropertyMap(std::shared_ptr eoj, unsigned short tid, unsigned char esv, EchoProperty& property, bool success);
178 |
179 | };
180 |
181 | class Setter : public EchoObject::Setter {
182 | public:
183 | Setter(unsigned short dstEchoClassCode, unsigned char dstEchoInstanceCode
184 | , std::string dstEchoAddress, bool responseRequired);
185 | virtual ~Setter();
186 | virtual DeviceObject::Setter& reqSetProperty(unsigned char epc, std::vector edt);
187 |
188 | virtual DeviceObject::Setter& reqSetOperationStatus(std::vector edt);
189 | virtual DeviceObject::Setter& reqSetInstallationLocation(std::vector edt);
190 | virtual DeviceObject::Setter& reqSetCurrentLimitSetting(std::vector edt);
191 | virtual DeviceObject::Setter& reqSetPowerSavingOperationSetting(std::vector edt);
192 | virtual DeviceObject::Setter& reqSetRemoteControlSetting(std::vector edt);
193 | virtual DeviceObject::Setter& reqSetCurrentTimeSetting(std::vector edt);
194 | virtual DeviceObject::Setter& reqSetCurrentDateSetting(std::vector edt);
195 | virtual DeviceObject::Setter& reqSetPowerLimitSetting(std::vector edt);
196 |
197 | };
198 |
199 | class Getter : public EchoObject::Getter {
200 | public:
201 | Getter(unsigned short dstEchoClassCode, unsigned char dstEchoInstanceCode
202 | , std::string dstEchoAddress);
203 | virtual ~Getter();
204 | virtual DeviceObject::Getter& reqGetProperty(unsigned char epc);
205 |
206 | virtual DeviceObject::Getter& reqGetOperationStatus();
207 | virtual DeviceObject::Getter& reqGetInstallationLocation();
208 | virtual DeviceObject::Getter& reqGetStandardVersionInformation();
209 | virtual DeviceObject::Getter& reqGetIdentificationNumber();
210 | virtual DeviceObject::Getter& reqGetMeasuredInstantaneousPowerConsumption();
211 | virtual DeviceObject::Getter& reqGetMeasuredCumulativePowerConsumption();
212 | virtual DeviceObject::Getter& reqGetManufacturersFaultCode();
213 | virtual DeviceObject::Getter& reqGetCurrentLimitSetting();
214 | virtual DeviceObject::Getter& reqGetFaultStatus();
215 | virtual DeviceObject::Getter& reqGetFaultDescription();
216 | virtual DeviceObject::Getter& reqGetManufacturerCode();
217 | virtual DeviceObject::Getter& reqGetBusinessFacilityCode();
218 | virtual DeviceObject::Getter& reqGetProductCode();
219 | virtual DeviceObject::Getter& reqGetProductionNumber();
220 | virtual DeviceObject::Getter& reqGetProductionDate();
221 | virtual DeviceObject::Getter& reqGetPowerSavingOperationSetting();
222 | virtual DeviceObject::Getter& reqGetRemoteControlSetting();
223 | virtual DeviceObject::Getter& reqGetCurrentTimeSetting();
224 | virtual DeviceObject::Getter& reqGetCurrentDateSetting();
225 | virtual DeviceObject::Getter& reqGetPowerLimitSetting();
226 | virtual DeviceObject::Getter& reqGetCumulativeOperatingTime();
227 | virtual DeviceObject::Getter& reqGetStatusChangeAnnouncementPropertyMap();
228 | virtual DeviceObject::Getter& reqGetSetPropertyMap();
229 | virtual DeviceObject::Getter& reqGetGetPropertyMap();
230 | };
231 |
232 | class Informer : public EchoObject::Informer {
233 | public:
234 | Informer(unsigned short echoClassCode, unsigned char echoInstanceCode
235 | , std::string dstEchoAddress, bool isSelfObject);
236 | virtual ~Informer();
237 | virtual DeviceObject::Informer& reqInformProperty(unsigned char epc);
238 |
239 | virtual DeviceObject::Informer& reqInformOperationStatus();
240 | virtual DeviceObject::Informer& reqInformInstallationLocation();
241 | virtual DeviceObject::Informer& reqInformStandardVersionInformation();
242 | virtual DeviceObject::Informer& reqInformIdentificationNumber();
243 | virtual DeviceObject::Informer& reqInformMeasuredInstantaneousPowerConsumption();
244 | virtual DeviceObject::Informer& reqInformMeasuredCumulativePowerConsumption();
245 | virtual DeviceObject::Informer& reqInformManufacturersFaultCode();
246 | virtual DeviceObject::Informer& reqInformCurrentLimitSetting();
247 | virtual DeviceObject::Informer& reqInformFaultStatus();
248 | virtual DeviceObject::Informer& reqInformFaultDescription();
249 | virtual DeviceObject::Informer& reqInformManufacturerCode();
250 | virtual DeviceObject::Informer& reqInformBusinessFacilityCode();
251 | virtual DeviceObject::Informer& reqInformProductCode();
252 | virtual DeviceObject::Informer& reqInformProductionNumber();
253 | virtual DeviceObject::Informer& reqInformProductionDate();
254 | virtual DeviceObject::Informer& reqInformPowerSavingOperationSetting();
255 | virtual DeviceObject::Informer& reqInformRemoteControlSetting();
256 | virtual DeviceObject::Informer& reqInformCurrentTimeSetting();
257 | virtual DeviceObject::Informer& reqInformCurrentDateSetting();
258 | virtual DeviceObject::Informer& reqInformPowerLimitSetting();
259 | virtual DeviceObject::Informer& reqInformCumulativeOperatingTime();
260 | virtual DeviceObject::Informer& reqInformStatusChangeAnnouncementPropertyMap();
261 | virtual DeviceObject::Informer& reqInformSetPropertyMap();
262 | virtual DeviceObject::Informer& reqInformGetPropertyMap();
263 |
264 | };
265 |
266 | class InformerC : public EchoObject::InformerC {
267 | public:
268 | InformerC(unsigned short srcEchoClassCode, unsigned char srcEchoInstanceCode
269 | , std::string dstEchoAddress);
270 | virtual ~InformerC();
271 | virtual DeviceObject::InformerC& reqInformProperty(unsigned char epc);
272 | };
273 |
274 | };
275 |
276 | class DeviceObject::Proxy : public DeviceObject {
277 | protected:
278 | unsigned short mEchoClassCode;
279 | public:
280 | Proxy(unsigned short echoClassCode, unsigned char echoInstanceCode);
281 | virtual ~Proxy();
282 |
283 | virtual unsigned char getInstanceCode();
284 | virtual unsigned short getEchoClassCode();
285 |
286 | virtual std::shared_ptr > getOperationStatus();
287 | virtual bool setInstallationLocation(std::vector& edt);
288 | virtual std::shared_ptr > getInstallationLocation();
289 | virtual std::shared_ptr > getFaultStatus();
290 | virtual std::shared_ptr > getManufacturerCode();
291 | };
292 |
293 | };
294 |
295 | #endif /* DEVICEOBJECT_H_ */
296 |
--------------------------------------------------------------------------------
/src/openecho/Echo.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Echo.cpp
3 | *
4 | * Created on: 2013/10/21
5 | * Author: Fumiaki
6 | */
7 |
8 | #include "Echo.h"
9 | #include "OpenECHO.h"
10 | #include "HouseholdSolarPowerGeneration.h"
11 | #include "SmartElectricEnergyMeter.h"
12 |
13 |
14 | namespace sonycsl_openecho {
15 |
16 | std::shared_ptr Echo::sStorage;
17 | std::shared_ptr Echo::sSelfNode;
18 | std::map > Echo::sOtherNodes;
19 | Echo::EventListenerDelegate Echo::sEventListenerDelegate;
20 |
21 | Echo::Echo() {
22 | // TODO Auto-generated constructor stub
23 |
24 | }
25 |
26 | Echo::~Echo() {
27 | // TODO Auto-generated destructor stub
28 | }
29 |
30 | std::shared_ptr Echo::start(
31 | std::shared_ptr profile,
32 | std::vector > devices) {
33 | if(sStorage.get() == nullptr) {
34 | sStorage = std::shared_ptr(new EchoStorage());
35 | }
36 |
37 | sSelfNode = std::shared_ptr(new EchoNode(profile, devices));
38 | sSelfNode.get()->getNodeProfile().get()->setNode(sSelfNode);
39 | int devicesSize = devices.size();
40 | for(int i = 0; i < devicesSize; i++) {
41 | devices.at(i).get()->setNode(sSelfNode);
42 | }
43 |
44 |
45 | EchoSocket::openSocket();
46 | EchoSocket::startReceiverThread();
47 | //Echo::getEventListener().onNewNode(sSelfNode);
48 | //Echo::getEventListener().onFoundNode(sSelfNode);
49 | //sSelfNode.get()->onNewNode();
50 | //sSelfNode.get()->onFoundNode();
51 | sSelfNode.get()->onNew(sSelfNode);
52 | sSelfNode.get()->onFound(sSelfNode);
53 |
54 | sSelfNode.get()->getNodeProfile().get()->onNew(sSelfNode.get()->getNodeProfile());
55 | sSelfNode.get()->getNodeProfile().get()->onFound(sSelfNode.get()->getNodeProfile());
56 |
57 | for(int i = 0; i < devicesSize; i++) {
58 | devices.at(i).get()->onNew(devices.at(i));
59 | devices.at(i).get()->onFound(devices.at(i));
60 |
61 | }
62 |
63 | profile.get()->inform().reqInformInstanceListNotification().send();
64 |
65 | return sSelfNode;
66 | }
67 |
68 | void Echo::restart() {
69 | }
70 |
71 | void Echo::stop() {
72 | }
73 |
74 | bool Echo::isStarted() {
75 | return true;
76 | }
77 |
78 | void Echo::setStorage(std::shared_ptr storage) {
79 | sStorage = storage;
80 | }
81 |
82 | std::shared_ptr Echo::getStorage() {
83 | return sStorage;
84 | }
85 |
86 | Echo::EventListener& Echo::getEventListenerDelegate() {
87 | return sEventListenerDelegate;
88 | }
89 |
90 | std::shared_ptr Echo::getSelfNode() {
91 | return sSelfNode;
92 | }
93 |
94 | std::vector > Echo::getNodes() {
95 | std::vector > nodes;
96 | nodes.push_back(sSelfNode);
97 | for(std::map >::iterator itr = sOtherNodes.begin();
98 | itr != sOtherNodes.end(); itr++) {
99 | nodes.push_back(itr->second);
100 | }
101 | return nodes;
102 | }
103 |
104 | std::shared_ptr Echo::getNode(std::string address) {
105 | if(EchoSocket::SELF_ADDRESS == address) {
106 | return sSelfNode;
107 | }
108 | if (sOtherNodes.find(address) == sOtherNodes.end()) {
109 | std::shared_ptr node;
110 | return node;
111 | } else {
112 | return sOtherNodes.at(address);
113 | }
114 | }
115 |
116 | bool Echo::containsNode(std::string address) {
117 | std::shared_ptr node = getNode(address);
118 | if(node.get() == NULL) {
119 | return false;
120 | }
121 | return true;
122 | }
123 |
124 | std::shared_ptr Echo::addOtherNode(std::string address) {
125 | std::shared_ptr node(new EchoNode(address));
126 | node.get()->getNodeProfile().get()->setNode(node);
127 | sOtherNodes.insert(std::map >::value_type(address, node));
128 | return node;
129 | }
130 |
131 | void Echo::addEventListener(
132 | std::shared_ptr eventListener) {
133 | sEventListenerDelegate.addEventListener(eventListener);
134 | }
135 |
136 | void Echo::removeEventListener(
137 | std::shared_ptr eventListener) {
138 | sEventListenerDelegate.removeEventListener(eventListener);
139 | }
140 |
141 | void Echo::removeOtherNode(std::string address) {
142 | if (sOtherNodes.find(address) == sOtherNodes.end()) {
143 | //std::shared_ptr node;
144 | //return node;
145 | } else {
146 | //return mOtherNodes.at(address);
147 | sOtherNodes.erase(address);
148 | }
149 | }
150 |
151 | void Echo::EventListener::onNewNode(std::shared_ptr node) {
152 | }
153 |
154 | void Echo::EventListener::onNewHouseholdSolarPowerGeneration(std::shared_ptr device)
155 | {
156 | }
157 | void Echo::EventListener::onNewSmartElectricEnergyMeter(std::shared_ptr device)
158 | {
159 | }
160 |
161 | void Echo::EventListener::onFoundNode(std::shared_ptr node) {
162 | }
163 |
164 | void Echo::EventListener::onNewEchoObject(std::shared_ptr eoj) {
165 | }
166 |
167 | void Echo::EventListener::onFoundEchoObject(std::shared_ptr eoj) {
168 | }
169 |
170 | void Echo::EventListener::onNewNodeProfile(
171 | std::shared_ptr profile) {
172 | }
173 |
174 | Echo::EventListener::EventListener() {
175 | }
176 |
177 | Echo::EventListener::~EventListener() {
178 | }
179 |
180 | void Echo::EventListener::onNewDeviceObject(std::shared_ptr device) {
181 | }
182 |
183 |
184 |
185 |
186 | void Echo::EventListener::onSendFrame(EchoFrame& frame) {
187 | }
188 |
189 | void Echo::EventListener::onReceiveFrame(EchoFrame& frame) {
190 | }
191 |
192 | void Echo::EventListenerDelegate::addEventListener(
193 | std::shared_ptr eventListener) {
194 | mEventListeners.push_back(eventListener);
195 |
196 | }
197 |
198 | void Echo::EventListenerDelegate::removeEventListener(
199 | std::shared_ptr eventListener) {
200 | std::list >::iterator it = mEventListeners.begin();
201 | while( it != mEventListeners.end() ) {
202 | if((*it).get() == eventListener.get()) {
203 | mEventListeners.erase(it);
204 | break;
205 | }
206 | ++it;
207 | }
208 | }
209 |
210 | void Echo::EventListenerDelegate::onNewNode(std::shared_ptr node) {
211 | std::list >::iterator it = mEventListeners.begin();
212 | while( it != mEventListeners.end() ) {
213 | (*it).get()->onNewNode(node);
214 | ++it;
215 | }
216 | }
217 |
218 |
219 | void Echo::EventListenerDelegate::onFoundNode(std::shared_ptr node) {
220 | std::list >::iterator it = mEventListeners.begin();
221 | while( it != mEventListeners.end() ) {
222 | (*it).get()->onFoundNode(node);
223 | ++it;
224 | }
225 | }
226 |
227 | void Echo::EventListenerDelegate::onNewEchoObject(
228 | std::shared_ptr eoj) {
229 | std::list >::iterator it = mEventListeners.begin();
230 | while( it != mEventListeners.end() ) {
231 | (*it).get()->onNewEchoObject(eoj);
232 | ++it;
233 | }
234 | }
235 |
236 | void Echo::EventListenerDelegate::onFoundEchoObject(
237 | std::shared_ptr eoj) {
238 | std::list >::iterator it = mEventListeners.begin();
239 | while( it != mEventListeners.end() ) {
240 | (*it).get()->onFoundEchoObject(eoj);
241 | ++it;
242 | }
243 | }
244 |
245 | void Echo::EventListenerDelegate::onNewNodeProfile(
246 | std::shared_ptr profile) {
247 | std::list >::iterator it = mEventListeners.begin();
248 | while( it != mEventListeners.end() ) {
249 | (*it).get()->onNewNodeProfile(profile);
250 | ++it;
251 | }
252 | }
253 |
254 | void Echo::EventListenerDelegate::onNewDeviceObject(
255 | std::shared_ptr device) {
256 | std::list >::iterator it = mEventListeners.begin();
257 | while( it != mEventListeners.end() ) {
258 | (*it).get()->onNewDeviceObject(device);
259 | ++it;
260 | }
261 | }
262 |
263 | void Echo::EventListenerDelegate::onNewHouseholdSolarPowerGeneration(std::shared_ptr device){
264 | std::list>::iterator it = mEventListeners.begin();
265 | while(it != mEventListeners.end()){
266 | (*it).get()->onNewHouseholdSolarPowerGeneration(device);
267 | ++it;
268 | }
269 | }
270 | void Echo::EventListenerDelegate::onNewSmartElectricEnergyMeter(std::shared_ptr device){
271 | std::list>::iterator it = mEventListeners.begin();
272 | while(it != mEventListeners.end()){
273 | (*it).get()->onNewSmartElectricEnergyMeter(device);
274 | ++it;
275 | }
276 | }
277 |
278 | void Echo::EventListenerDelegate::onSendFrame(EchoFrame& frame) {
279 |
280 | std::list >::iterator it = mEventListeners.begin();
281 | while( it != mEventListeners.end() ) {
282 | (*it).get()->onSendFrame(frame);
283 | ++it;
284 | }
285 | }
286 |
287 | void Echo::EventListenerDelegate::onReceiveFrame(EchoFrame& frame) {
288 |
289 | std::list >::iterator it = mEventListeners.begin();
290 | while( it != mEventListeners.end() ) {
291 | (*it).get()->onReceiveFrame(frame);
292 | ++it;
293 | }
294 | }
295 |
296 | void Echo::Logger::onNewNode(std::shared_ptr node) {
297 | std::cout << "[onNewNode]address:" << node.get()->getAddress() << std::endl;
298 | }
299 |
300 | void Echo::Logger::onFoundNode(std::shared_ptr node) {
301 | std::cout << "[onFoundNode]address:" << node.get()->getAddress() << std::endl;
302 | }
303 |
304 | void Echo::Logger::onNewEchoObject(std::shared_ptr eoj) {
305 | std::cout << "[onNewEchoObject]address:" << eoj.get()->getNode().get()->getAddress() << ",echo_class_code:"
306 | << std::hex << eoj.get()->getEchoClassCode() << ",instance_code:"
307 | << std::hex << (int)(eoj.get()->getInstanceCode()) << std::endl;
308 | }
309 |
310 | void Echo::Logger::onFoundEchoObject(std::shared_ptr eoj) {
311 | std::cout << "[onFoundEchoObject]address:" << eoj.get()->getNode().get()->getAddress() << ",echo_class_code:"
312 | << std::hex << eoj.get()->getEchoClassCode() << ",instance_code:"
313 | << std::hex << (int)(eoj.get()->getInstanceCode()) << std::endl;
314 | }
315 |
316 | void Echo::Logger::onSendFrame(EchoFrame& frame) {
317 |
318 | std::vector byteArray = frame.getFrameByteArray();
319 | int size = byteArray.size();
320 | unsigned char buffer[size];
321 | for (int i = 0; i < size; i++) {
322 | buffer[i] = byteArray.at(i);
323 | }
324 |
325 | std::cout << "[onSendFrame]data:" << std::hex;
326 | for (int i = 0; i < size; i++) {
327 | std::cout << (int) (buffer[i]) << " ";
328 | }
329 | std::cout << ", to:" << frame.getDstEchoAddress() << std::endl;
330 |
331 | }
332 |
333 | void Echo::Logger::onReceiveFrame(EchoFrame& frame) {
334 |
335 | std::vector byteArray = frame.getFrameByteArray();
336 | int size = byteArray.size();
337 | unsigned char buffer[size];
338 | for (int i = 0; i < size; i++) {
339 | buffer[i] = byteArray.at(i);
340 | }
341 |
342 |
343 | std::cout << "[onReceiveFrame]:data:" << std::hex;
344 | for (int i = 0; i < size; i++) {
345 | std::cout << (int) (buffer[i]) << " ";
346 | }
347 | std::cout << ", from:" << frame.getSrcEchoAddress() << std::endl;
348 | }
349 | };
350 |
351 |
--------------------------------------------------------------------------------
/src/openecho/Echo.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Echo.h
3 | *
4 | * Created on: 2013/10/21
5 | * Author: Fumiaki
6 | */
7 |
8 | #ifndef ECHO_H_
9 | #define ECHO_H_
10 |
11 | #include