Skip to content
Browse files

Removed print statements and one unnecesary method in OLCB_Event_Handler

  • Loading branch information...
1 parent 5b4c5b7 commit 584d8c4469d6e9abd8cb5e5b85aa55e72ba0909f @DEGoodmanWilson DEGoodmanWilson committed Jan 31, 2012
Showing with 31 additions and 30 deletions.
  1. +31 −29 OLCB_Event_Handler.cpp
  2. +0 −1 OLCB_Event_Handler.h
View
60 OLCB_Event_Handler.cpp
@@ -15,16 +15,16 @@ void OLCB_Event_Handler::update(void) //this method should be overridden to dete
// see if any replies are waiting to send
while (_sendEvent < _numEvents)
{
-// Serial.print(" i = ");
-// Serial.print(_sendEvent, DEC);
-// Serial.print(" ");
-// Serial.print(_events[_sendEvent].flags, HEX);
-// Serial.print(": ");
+// //Serial.print(" i = ");
+// //Serial.print(_sendEvent, DEC);
+// //Serial.print(" ");
+// //Serial.print(_events[_sendEvent].flags, HEX);
+// //Serial.print(": ");
// OK to send, see if marked for some cause
// ToDo: This only sends _either_ producer ID'd or consumer ID'd, not both
if ( (_events[_sendEvent].flags & (IDENT_FLAG | OLCB_Event::CAN_PRODUCE_FLAG)) == (IDENT_FLAG | OLCB_Event::CAN_PRODUCE_FLAG))
{
-// Serial.println("identify producer");
+// //Serial.println("identify producer");
if(_link->sendProducerIdentified(&_events[_sendEvent]))
{
//Serial.println(_events[_sendEvent].flags, HEX);
@@ -35,7 +35,7 @@ void OLCB_Event_Handler::update(void) //this method should be overridden to dete
}
else if ( (_events[_sendEvent].flags & (IDENT_FLAG | OLCB_Event::CAN_CONSUME_FLAG)) == (IDENT_FLAG | OLCB_Event::CAN_CONSUME_FLAG))
{
-// Serial.println("identify consumer");
+// //Serial.println("identify consumer");
if(_link->sendConsumerIdentified(&_events[_sendEvent]))
{
_events[_sendEvent].flags &= ~IDENT_FLAG; // reset flag
@@ -44,15 +44,18 @@ void OLCB_Event_Handler::update(void) //this method should be overridden to dete
}
else if (_events[_sendEvent].flags & PRODUCE_FLAG)
{
-// Serial.print("producing ");
-// Serial.println(_sendEvent, DEC);
+// //Serial.print("producing ");
+// //Serial.println(_sendEvent, DEC);
if(_link->sendPCER(&_events[_sendEvent]))
_events[_sendEvent].flags &= ~PRODUCE_FLAG; // reset flag
break; // only send one from this loop
}
else if (_events[_sendEvent].flags & TEACH_FLAG)
{
- Serial.println("teach");
+ //Serial.println("ABOUT TO SEND TEACH MESSAGE");
+ //Serial.println(_sendEvent, DEC);
+ //Serial.println(_events[_sendEvent].val[6], HEX);
+ //Serial.println(_events[_sendEvent].val[7], HEX);
_link->sendLearnEvent(&_events[_sendEvent]);
_events[_sendEvent].flags &= ~TEACH_FLAG; // reset flag
break; // only send one from this loop
@@ -69,20 +72,20 @@ void OLCB_Event_Handler::loadEvents(OLCB_Event* events, uint16_t numEvents)
{
_events = events;
_numEvents = numEvents;
-// Serial.println("loadEvents");
+ //Serial.println("loadEvents");
for(uint16_t i = 0; i < _numEvents; ++i)
{
_events[i].flags = 0;
-// Serial.print(i, DEC);
-// Serial.print(" ");
-// Serial.println(_events[i].flags, HEX);
+ //Serial.print(i, DEC);
+ //Serial.print(" ");
+ //Serial.println(_events[i].flags, HEX);
}
}
bool OLCB_Event_Handler::produce(uint16_t index) //OLCB_Event *event) //call to produce an event with ID = EID
{
-// Serial.print("produce() ");
-// Serial.println(index);
+ //Serial.print("produce() ");
+ //Serial.println(index);
bool retval = false;
// int8_t index = 0;
// while (-1 != (index = event->findIndexInArray(_events, _numEvents, index)))
@@ -179,7 +182,7 @@ bool OLCB_Event_Handler::handlePCEventReport(OLCB_Event *event)
{
if (_events[index].flags & OLCB_Event::CAN_CONSUME_FLAG)
{
-// Serial.println("Consuming event");
+// //Serial.println("Consuming event");
// yes, notify our own code
if(consume(event))
{
@@ -268,16 +271,19 @@ void OLCB_Event_Handler::newEvent(int index, bool p, bool c)
if (c) _events[index].flags |= OLCB_Event::CAN_CONSUME_FLAG;
-// Serial.print("new event ");
-// Serial.print(index, DEC);
-// Serial.print(" ");
-// Serial.println(_events[index].flags, HEX);
+// //Serial.print("new event ");
+// //Serial.print(index, DEC);
+// //Serial.print(" ");
+// //Serial.println(_events[index].flags, HEX);
}
void OLCB_Event_Handler::markToLearn(int index, bool mark)
{
+ //Serial.println("Mark to Learn:");
+ //Serial.println(index,DEC);
+ //Serial.println(mark,DEC);
if (mark)
_events[index].flags |= LEARN_FLAG;
else
@@ -286,10 +292,14 @@ void OLCB_Event_Handler::markToLearn(int index, bool mark)
void OLCB_Event_Handler::markToTeach(int index, bool mark)
{
+ //Serial.println("Mark to Teach:");
+ //Serial.println(index,DEC);
+ //Serial.println(mark,DEC);
if (mark)
_events[index].flags |= TEACH_FLAG;
else
_events[index].flags &= ~TEACH_FLAG;
+ _sendEvent = min(_sendEvent, index);
}
bool OLCB_Event_Handler::markedToLearn(int index)
@@ -302,14 +312,6 @@ bool OLCB_Event_Handler::markedToTeach(int index)
return(_events[index].flags & TEACH_FLAG);
}
-
-void OLCB_Event_Handler::sendTeach(int index)
-{
- _events[index].flags |= TEACH_FLAG;
- _sendEvent = min(_sendEvent, index);
-}
-
-
bool OLCB_Event_Handler::store(void)
{
return false; //false for not saved!
View
1 OLCB_Event_Handler.h
@@ -47,7 +47,6 @@ class OLCB_Event_Handler: public OLCB_Handler
void markToTeach(int index, bool mark);
bool markedToLearn(int index);
bool markedToTeach(int index);
- void sendTeach(int index);
protected:

0 comments on commit 584d8c4

Please sign in to comment.
Something went wrong with that request. Please try again.