Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
Consistent Naming
Browse files Browse the repository at this point in the history
Remove multiple name references for Input/Output (i.e.
Contact/Switch/Relay).
  • Loading branch information
Steven Dillingham authored and Steven Dillingham committed Jun 10, 2014
1 parent ca5ea95 commit 7c90e3f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions PACSDoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bool PACSDoor::pushREX(char* rexId) {
bool PACSDoor::activateInput(char* inputId) {

PACSPeripheral* p = findPeripheralById(inputId);
if ((p != NULL) && (p->type == CONTACT)) {
if ((p != NULL) && (p->type == DIGITAL_INPUT)) {
setPinActive(p->pin, p->activeLevel);
return true;
}
Expand All @@ -183,7 +183,7 @@ bool PACSDoor::activateInput(char* inputId) {
bool PACSDoor::deactivateInput(char* inputId) {

PACSPeripheral* p = findPeripheralById(inputId);
if ((p != NULL) && (p->type == CONTACT)) {
if ((p != NULL) && (p->type == DIGITAL_INPUT)) {
setPinInactive(p->pin, p->activeLevel);
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions PACSPeripheral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ void PACSPeripheral::initialize() {
switch (type) {
case DOORMONITOR:
case REX:
case CONTACT:
case RELAY:
case DIGITAL_INPUT:
case DIGITAL_OUTPUT:
pinMode(pin, OUTPUT);
digitalWrite(pin, initialLevel);
break;
Expand Down Expand Up @@ -80,8 +80,8 @@ void PACSPeripheral::updateLevels() {
case GREENLED:
case BEEPER:
case LOCK:
case CONTACT:
case RELAY:
case DIGITAL_INPUT:
case DIGITAL_OUTPUT:
currentLevel = digitalRead(pin);
break;

Expand Down
2 changes: 1 addition & 1 deletion PACSPeripheral.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

#define PERIPHERAL_ID_MAX_LENGTH 16 // The max number of characters for the ID.

typedef enum {GREENLED, BEEPER, DOORMONITOR, REX, LOCK, CONTACT, RELAY} PACSPeripheralType_t;
typedef enum {GREENLED, BEEPER, DOORMONITOR, REX, LOCK, DIGITAL_INPUT, DIGITAL_OUTPUT} PACSPeripheralType_t;

class PACSPeripheral {
public:
Expand Down
32 changes: 16 additions & 16 deletions dctt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ bool getNextToken(Stream& stream, char* tokenBuffer, uint8_t length) {
// the global one.
namespace Cfg {
enum Pos {
NONE, DOOR, READER, DOOR_MONITOR, REX, LOCK, CONTACT, RELAY, //Container
NONE, DOOR, READER, DOOR_MONITOR, REX, LOCK, DIGITAL_INPUT, DIGITAL_OUTPUT, //Container
WIEGAND, GREEN_LED, BEEPER, //Subcontainer
ID, PIN, PIN_ZERO, PIN_ONE, ACTIVE //Property
};
Expand Down Expand Up @@ -475,12 +475,12 @@ int parseDoor(Stream& stream, char* startToken, char* stopToken) {
openBraces = 0;
}
else if (strcmp(token, "Input") == 0) {
cfgPos = Cfg::CONTACT;
cfgPos = Cfg::DIGITAL_OUTPUT;
cfgParent = Cfg::DOOR;
openBraces = 0;
}
else if (strcmp(token, "Relay") == 0) {
cfgPos = Cfg::RELAY;
else if (strcmp(token, "Output") == 0) {
cfgPos = Cfg::DIGITAL_OUTPUT;
cfgParent = Cfg::DOOR;
openBraces = 0;
}
Expand Down Expand Up @@ -516,8 +516,8 @@ int parseDoor(Stream& stream, char* startToken, char* stopToken) {
case Cfg::DOOR_MONITOR:
case Cfg::REX:
case Cfg::LOCK:
case Cfg::CONTACT:
case Cfg::RELAY:
case Cfg::DIGITAL_INPUT:
case Cfg::DIGITAL_OUTPUT:
strcpy(tempPeripheral.id, token);
}
}
Expand All @@ -529,8 +529,8 @@ int parseDoor(Stream& stream, char* startToken, char* stopToken) {
case Cfg::DOOR_MONITOR:
case Cfg::REX:
case Cfg::LOCK:
case Cfg::CONTACT:
case Cfg::RELAY:
case Cfg::DIGITAL_INPUT:
case Cfg::DIGITAL_OUTPUT:
tempPeripheral.pin = getPinNumber(token);
if (!isValidPin) {
return -1;
Expand Down Expand Up @@ -563,8 +563,8 @@ int parseDoor(Stream& stream, char* startToken, char* stopToken) {
case Cfg::DOOR_MONITOR:
case Cfg::REX:
case Cfg::LOCK:
case Cfg::CONTACT:
case Cfg::RELAY:
case Cfg::DIGITAL_INPUT:
case Cfg::DIGITAL_OUTPUT:
case Cfg::GREEN_LED:
case Cfg::BEEPER:
if (strcmp(token, "HIGH") == 0) {
Expand Down Expand Up @@ -638,15 +638,15 @@ int parseDoor(Stream& stream, char* startToken, char* stopToken) {
tempPeripheral.pin,
tempPeripheral.activeLevel);
break;
case Cfg::CONTACT:
case Cfg::DIGITAL_INPUT:
tempDoor->addPeripheral(tempPeripheral.id,
CONTACT,
DIGITAL_INPUT,
tempPeripheral.pin,
tempPeripheral.activeLevel);
break;
case Cfg::RELAY:
case Cfg::DIGITAL_OUTPUT:
tempDoor->addPeripheral(tempPeripheral.id,
RELAY,
DIGITAL_OUTPUT,
tempPeripheral.pin,
tempPeripheral.activeLevel);
break;
Expand Down Expand Up @@ -1265,8 +1265,8 @@ void onStateChange(PACSDoor &door, PACSPeripheral &p) {
case DOORMONITOR:
case REX:
case LOCK:
case CONTACT:
case RELAY:
case DIGITAL_INPUT:
case DIGITAL_OUTPUT:

cout << "[" << door.id << "|" << p.id << "]: ";

Expand Down
8 changes: 4 additions & 4 deletions sd_card/web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,17 +569,17 @@ app.directive('lock', function() {
}
});

app.directive('switch', function() {
app.directive('digitalinput', function() {
return {
restrict: 'E',
templateUrl: 'switch.htm'
templateUrl: 'input.htm'
}
});

app.directive('relay', function() {
app.directive('digitaloutput', function() {
return {
restrict: 'E',
templateUrl: 'relay.htm'
templateUrl: 'output.htm'
}
});

Expand Down
28 changes: 14 additions & 14 deletions sd_card/web/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
.greenLED-off {
color:#D74B4B;
}
.switch-on {
.input-active {
color:#4080FF;
}
.switch-off {
.input-inactive {
color:#ECE9E4;
}
.relay-active {
.output-active {
color:#03A711;
}
.relay-inactive {
.output-inactive {
color:#ECE9E4;
}

Expand Down Expand Up @@ -165,16 +165,16 @@
</div>
</script>

<!-- SWITCH PARTIAL-->
<script type="text/ng-template" id="switch.htm">
<!-- INPUT PARTIAL-->
<script type="text/ng-template" id="input.htm">
<div class="panel panel-default">
<div class="panel-heading">
Input <small class="pull-right text-muted"><em>{{input.Id}}</em></small>
</div>
<div class="panel-body">
<div>
<p ng-show="isConnected()" align="center">
<i class="fa fa-power-off fa-3x" ng-class="{'switch-on': input.IsActive, 'switch-off': !input.IsActive}"></i>
<i class="fa fa-power-off fa-3x" ng-class="{'input-active': input.IsActive, 'input-inactive': !input.IsActive}"></i>
</p>
<button ng-show="isConnected()" id="inputButton" type="button" class="btn btn-default btn-md btn-block" ng-disabled="!isConnected()" ng-click="getInputButton(door, input).action()">
{{getInputButton(door, input).text}}
Expand All @@ -184,16 +184,16 @@
</div>
</script>

<!-- RELAY PARTIAL-->
<script type="text/ng-template" id="relay.htm">
<!-- OUTPUT PARTIAL-->
<script type="text/ng-template" id="output.htm">
<div class="panel panel-default">
<div class="panel-heading">
Relay <small class="pull-right text-muted"><em>{{relay.Id}}</em></small>
Output <small class="pull-right text-muted"><em>{{output.Id}}</em></small>
</div>
<div class="panel-body">
<div>
<p ng-show="isConnected()" align="center">
<i class="fa fa-circle fa-2x" ng-class="{'relay-active': relay.IsActive, 'relay-inactive': !relay.IsActive}"></i>
<i class="fa fa-lightbulb-o fa-3x" ng-class="{'output-active': output.IsActive, 'output-inactive': !output.IsActive}"></i>
</p>
</div>
</div>
Expand Down Expand Up @@ -265,11 +265,11 @@
</div>

<div class="col-md-6" ng-repeat="input in door.Input">
<switch></switch>
<digitalinput></digitalinput>
</div>

<div class="col-md-6" ng-repeat="relay in door.Relay">
<relay></relay>
<div class="col-md-6" ng-repeat="output in door.Output">
<digitaloutput></digitaloutput>
</div>

</div>
Expand Down

0 comments on commit 7c90e3f

Please sign in to comment.