Commit 888ca67ddd8b74f0e5052176aeb205e51b53cf78
- Diff rendering mode:
- inline
- side by side
core/ds485/ds485proxy.cpp
(10 / 6)
|   | |||
| 218 | 218 | sstream << "0x" << std::hex << std::uppercase << int(_frame.getHeader().getDestination()); | |
| 219 | 219 | ||
| 220 | 220 | PayloadDissector pdDump(_frame.getPayload()); | |
| 221 | uint8_t cmd = pdDump.get<uint8_t>(); | ||
| 222 | sstream << ", CMD:0x" << std::hex << std::uppercase << (unsigned int)cmd << ","; | ||
| 223 | int iParameter=1; | ||
| 224 | while(!pdDump.isEmpty()) { | ||
| 225 | uint16_t data = pdDump.get<uint16_t>(); | ||
| 226 | sstream << " P" << iParameter++ << ":0x" << std::hex << std::uppercase << data; | ||
| 221 | if(!pdDump.isEmpty()) { | ||
| 222 | uint8_t cmd = pdDump.get<uint8_t>(); | ||
| 223 | sstream << ", CMD:0x" << std::hex << std::uppercase << (unsigned int)cmd << ","; | ||
| 224 | int iParameter=1; | ||
| 225 | while(!pdDump.isEmpty()) { | ||
| 226 | uint16_t data = pdDump.get<uint16_t>(); | ||
| 227 | sstream << " P" << iParameter++ << ":0x" << std::hex << std::uppercase << data; | ||
| 228 | } | ||
| 229 | } else { | ||
| 230 | sstream << " payload empty"; | ||
| 227 | 231 | } | |
| 228 | 232 | sstream << std::dec; | |
| 229 | 233 |
tests/ds485tests.cpp
(16 / 0)
|   | |||
| 32 | 32 | #include "core/ds485/ds485.h" | |
| 33 | 33 | #include "core/ds485types.h" | |
| 34 | 34 | ||
| 35 | #include "core/model/apartment.h" | ||
| 36 | #include "core/model/modelmaintenance.h" | ||
| 37 | #include "core/ds485/ds485proxy.h" | ||
| 38 | |||
| 35 | 39 | using namespace dss; | |
| 36 | 40 | ||
| 37 | 41 | BOOST_AUTO_TEST_SUITE(DS485) | |
| … | … | ||
| 180 | 180 | BOOST_CHECK_EQUAL(pd.get<dsid_t>().toString(), dsid.toString()); | |
| 181 | 181 | BOOST_CHECK(pd.isEmpty()); | |
| 182 | 182 | } // testPayload | |
| 183 | |||
| 184 | BOOST_AUTO_TEST_CASE(testSendingFrameWithEmptyPayload) { | ||
| 185 | Apartment apt(NULL); | ||
| 186 | ModelMaintenance maintenance(NULL); | ||
| 187 | maintenance.setApartment(&apt); | ||
| 188 | maintenance.initialize(); | ||
| 189 | DS485Proxy proxy(NULL, &maintenance); | ||
| 190 | proxy.setInitializeDS485Controller(false); | ||
| 191 | proxy.initialize(); | ||
| 192 | DS485CommandFrame frame; | ||
| 193 | proxy.sendFrame(frame); | ||
| 194 | } | ||
| 183 | 195 | ||
| 184 | 196 | BOOST_AUTO_TEST_SUITE_END() |

