• 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/E133StatusHelper.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
 * E133StatusHelper.cpp
17
 * Functions for dealing with E1.33 Status Codes.
18
 * Copyright (C) 2013 Simon Newton
19
 */
20

21
#include <stdint.h>
22
#include <string>
23
#include "ola/e133/E133StatusHelper.h"
24

25
namespace ola {
26
namespace e133 {
27

28
using std::string;
29

30
/**
31
 * Verify that the int is a valid E1.33 Status Code.
32
 */
33
bool IntToStatusCode(uint16_t input, E133StatusCode *status_code) {
×
34
  switch (input) {
×
35
    case ola::e133::SC_E133_ACK:
×
36
      *status_code = ola::e133::SC_E133_ACK;
×
37
      return true;
×
38
    case ola::e133::SC_E133_RDM_TIMEOUT:
×
39
      *status_code = ola::e133::SC_E133_RDM_TIMEOUT;
×
40
      return true;
×
41
    case ola::e133::SC_E133_RDM_INVALID_RESPONSE:
×
42
      *status_code = ola::e133::SC_E133_RDM_INVALID_RESPONSE;
×
43
      return true;
×
44
    case ola::e133::SC_E133_BUFFER_FULL:
×
45
      *status_code = ola::e133::SC_E133_BUFFER_FULL;
×
46
      return true;
×
47
    case ola::e133::SC_E133_UNKNOWN_UID:
×
48
      *status_code = ola::e133::SC_E133_UNKNOWN_UID;
×
49
      return true;
×
50
    case ola::e133::SC_E133_NONEXISTENT_ENDPOINT:
×
51
      *status_code = ola::e133::SC_E133_NONEXISTENT_ENDPOINT;
×
52
      return true;
×
53
    case ola::e133::SC_E133_WRONG_ENDPOINT:
×
54
      *status_code = ola::e133::SC_E133_WRONG_ENDPOINT;
×
55
      return true;
×
56
    case ola::e133::SC_E133_ACK_OVERFLOW_CACHE_EXPIRED:
×
57
      *status_code = ola::e133::SC_E133_ACK_OVERFLOW_CACHE_EXPIRED;
×
58
      return true;
×
59
    case ola::e133::SC_E133_ACK_OVERFLOW_IN_PROGRESS:
×
60
      *status_code = ola::e133::SC_E133_ACK_OVERFLOW_IN_PROGRESS;
×
61
      return true;
×
62
    case ola::e133::SC_E133_BROADCAST_COMPLETE:
×
63
      *status_code = ola::e133::SC_E133_BROADCAST_COMPLETE;
×
64
      return true;
×
65
    default:
66
      return false;
67
  }
68
}
69

70

71
/**
72
 * Return a text string describing this status code.
73
 */
74
string StatusCodeToString(E133StatusCode status_code) {
×
75
  switch (status_code) {
×
76
    case ola::e133::SC_E133_ACK:
×
77
     return "Acknowledged";
×
78
    case ola::e133::SC_E133_RDM_TIMEOUT:
×
79
     return "Response Timeout";
×
80
    case ola::e133::SC_E133_RDM_INVALID_RESPONSE:
×
81
     return "Invalid Response";
×
82
    case ola::e133::SC_E133_BUFFER_FULL:
×
83
     return "Buffer Full";
×
84
    case ola::e133::SC_E133_UNKNOWN_UID:
×
85
     return "Unknown UID";
×
86
    case ola::e133::SC_E133_NONEXISTENT_ENDPOINT:
×
87
     return "Endpoint doesn't exist";
×
88
    case ola::e133::SC_E133_WRONG_ENDPOINT:
×
89
     return "Wrong endpoint";
×
90
    case ola::e133::SC_E133_ACK_OVERFLOW_CACHE_EXPIRED:
×
91
     return "Ack overflow cache expired";
×
92
    case ola::e133::SC_E133_ACK_OVERFLOW_IN_PROGRESS:
×
93
     return "Ack overflow in progress";
×
94
    case ola::e133::SC_E133_BROADCAST_COMPLETE:
×
95
     return "Request was broadcast";
×
96
  }
97
  return "Unknown E1.33 Status Code";
×
98
}
99

100

NEW
101
bool IntToConnectStatusCode(uint16_t input,
×
102
                            E133ConnectStatusCode *connect_status_code) {
NEW
103
  switch (input) {
×
NEW
104
    case ola::e133::CONNECT_OK:
×
NEW
105
      *connect_status_code = ola::e133::CONNECT_OK;
×
NEW
106
      return true;
×
NEW
107
    case ola::e133::CONNECT_SCOPE_MISMATCH:
×
NEW
108
      *connect_status_code = ola::e133::CONNECT_SCOPE_MISMATCH;
×
NEW
109
      return true;
×
NEW
110
    case ola::e133::CONNECT_CAPACITY_EXCEEDED:
×
NEW
111
      *connect_status_code = ola::e133::CONNECT_CAPACITY_EXCEEDED;
×
NEW
112
      return true;
×
NEW
113
    case ola::e133::CONNECT_DUPLICATE_UID:
×
NEW
114
      *connect_status_code = ola::e133::CONNECT_DUPLICATE_UID;
×
NEW
115
      return true;
×
NEW
116
    case ola::e133::CONNECT_INVALID_CLIENT_ENTRY:
×
NEW
117
      *connect_status_code = ola::e133::CONNECT_INVALID_CLIENT_ENTRY;
×
NEW
118
      return true;
×
NEW
119
    case ola::e133::CONNECT_INVALID_UID:
×
NEW
120
      *connect_status_code = ola::e133::CONNECT_INVALID_UID;
×
NEW
121
      return true;
×
122
    default:
123
      return false;
124
  }
125
}
126

127

NEW
128
string ConnectStatusCodeToString(E133ConnectStatusCode connect_status_code) {
×
NEW
129
  switch (connect_status_code) {
×
NEW
130
    case ola::e133::CONNECT_OK:
×
NEW
131
     return "Ok";
×
NEW
132
    case ola::e133::CONNECT_SCOPE_MISMATCH:
×
NEW
133
     return "Scope mismatch";
×
NEW
134
    case ola::e133::CONNECT_CAPACITY_EXCEEDED:
×
NEW
135
     return "Capacity exceeded";
×
NEW
136
    case ola::e133::CONNECT_DUPLICATE_UID:
×
NEW
137
     return "Duplicate UID";
×
NEW
138
    case ola::e133::CONNECT_INVALID_CLIENT_ENTRY:
×
NEW
139
     return "Invalid client entry";
×
NEW
140
    case ola::e133::CONNECT_INVALID_UID:
×
NEW
141
     return "Invalid UID";
×
142
  }
NEW
143
  return "Unknown E1.33 Connect Status Code";
×
144
}
145
}  // namespace e133
146
}  // 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

© 2025 Coveralls, Inc