MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / sendStrings

Method sendStrings

Arduino/libraries/ST_Anything/Everything.cpp:67–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65#endif
66
67 void Everything::sendStrings()
68 {
69 unsigned int index;
70 //Loop through the Return_String buffer and send each "|" delimited string to ST Shield
71 while(Return_String.length()>=1 && Return_String[0]!='|')
72 {
73 index=Return_String.indexOf("|");
74 if(debug)
75 {
76 Serial.print(F("Everything: Sending: "));
77 Serial.println(Return_String.substring(0, index));
78 //Serial.print(F("Everything: getTransmitInterval() = "));
79 //Serial.println(SmartThing->getTransmitInterval());
80 }
81 #ifndef DISABLE_SMARTTHINGS
82// if (millis() - sendstringsLastMillis < Constants::SENDSTRINGS_INTERVAL)
83 if (millis() - sendstringsLastMillis < SmartThing->getTransmitInterval())
84 {
85// delay(Constants::SENDSTRINGS_INTERVAL - (millis() - sendstringsLastMillis)); //Added due to slow ST Hub/Cloud Processing. Events were being missed. DGO 2015-03-28
86 delay(SmartThing->getTransmitInterval() - (millis() - sendstringsLastMillis)); //modified to allow different values for each method of communicating to ST cloud. DGO 2017-04-26
87 }
88 SmartThing->send(Return_String.substring(0, index));
89 sendstringsLastMillis = millis();
90 #endif
91 #if defined(ENABLE_SERIAL) && defined(DISABLE_SMARTTHINGS)
92 Serial.println(Return_String.substring(0, index));
93 #endif
94
95 if(callOnMsgSend!=0)
96 {
97 callOnMsgSend(Return_String.substring(0, index));
98 }
99
100 Return_String=Return_String.substring(index+1);
101 }
102 Return_String.remove(0); //clear the Return_String buffer
103 }
104
105 void Everything::refreshDevices()
106 {

Callers

nothing calls this directly

Calls 4

printMethod · 0.80
printlnMethod · 0.80
getTransmitIntervalMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected