• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OpenLightingProject / ola / 8383043622

21 Mar 2024 11:25PM UTC coverage: 45.276% (+0.001%) from 45.275%
8383043622

push

github

web-flow
Merge pull request #1945 from peternewman/e1.33-cherry-pick

E1.33 cherry pick the second

7682 of 17750 branches covered (43.28%)

32 of 91 new or added lines in 11 files covered. (35.16%)

2 existing lines in 1 file now uncovered.

21691 of 47908 relevant lines covered (45.28%)

63.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/tools/e133/E133Helper.cpp
1
/*
2
 * This program is free software; you can redistribute it and/or modify
3
 * it under the terms of the GNU General Public License as published by
4
 * the Free Software Foundation; either version 2 of the License, or
5
 * (at your option) any later version.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU Library General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15
 *
16
 * E133Helper.cpp
17
 * Various misc E1.33 functions.
18
 * Copyright (C) 2024 Peter Newman
19
 *
20
 * At some point we may want to localize this file.
21
 */
22

23
#include <sstream>
24
#include <string>
25
#include <vector>
26
#include "ola/e133/E133Enums.h"
27
#include "ola/e133/E133Helper.h"
28
#include "ola/StringUtils.h"
29

30
namespace ola {
31
namespace e133 {
32

33
using std::ostringstream;
34
using std::string;
35
using std::vector;
36

37

38
/**
39
 * Verify that the int is a valid E1.33 RPT Client Type.
40
 */
NEW
41
bool IntToRPTClientType(uint8_t input,
×
42
                        ola::e133::E133RPTClientTypeCode *client_type) {
NEW
43
  switch (input) {
×
NEW
44
    case ola::e133::RPT_CLIENT_TYPE_DEVICE:
×
NEW
45
      *client_type = ola::e133::RPT_CLIENT_TYPE_DEVICE;
×
NEW
46
      return true;
×
NEW
47
    case ola::e133::RPT_CLIENT_TYPE_CONTROLLER:
×
NEW
48
      *client_type = ola::e133::RPT_CLIENT_TYPE_CONTROLLER;
×
NEW
49
      return true;
×
50
    default:
51
      return false;
52
  }
53
}
54

55

56
/**
57
 * Convert a uint8_t representing an RPT client type to a human-readable string.
58
 * @param type the RPT client type value
59
 */
NEW
60
string RPTClientTypeToString(uint8_t type) {
×
NEW
61
  switch (type) {
×
NEW
62
    case RPT_CLIENT_TYPE_DEVICE:
×
NEW
63
      return "Device";
×
NEW
64
    case RPT_CLIENT_TYPE_CONTROLLER:
×
NEW
65
      return "Controller";
×
NEW
66
    default:
×
NEW
67
      ostringstream str;
×
NEW
68
      str << "Unknown, was " << static_cast<int>(type);
×
NEW
69
      return str.str();
×
70
  }
71
}
72
}  // namespace e133
73
}  // namespace  ola
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc