Skip to content

Commit

Permalink
Masked system sleep call
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Cherednichenko committed Mar 25, 2013
1 parent ff5058e commit 8b00d4c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/PortIO.cpp
Expand Up @@ -162,7 +162,7 @@ unsigned int PortIO::receiveRawFromPort(char * const buffer, const unsigned int
* -1 if not enough size for incoming buffer or data integrity fail
*/
int PortIO::receiveFromPort(char * const buffer, const unsigned int size) const {
int totalBytes; /*number of total bytes read*/
unsigned int totalBytes; /*number of total bytes read*/

//read raw data from port into specified buffer,
//reserve last char in buffer for terminated key code
Expand Down Expand Up @@ -268,3 +268,7 @@ int PortIO::sendToPort(const char * const buffer) const {
#endif
return -1;
}

void PortIO::sleepPort(unsigned int seconds) {
sleep(seconds);
}
2 changes: 2 additions & 0 deletions src/PortIO.h
Expand Up @@ -40,6 +40,8 @@ class PortIO {
unsigned int receiveRawFromPort(char * const buffer, const unsigned int size) const;
int receiveFromPort(char * const buffer, const unsigned int size) const;
int sendToPort(const char * const buffer) const;

static void sleepPort(unsigned int seconds);
};

#endif /* PORTIO_H_ */
2 changes: 1 addition & 1 deletion src/Sim900.cpp
Expand Up @@ -95,7 +95,7 @@ int main() {
}

//open connection
sleep(5); /*small delay required!!!*/
PortIO::sleepPort(5); /*small delay required!!!*/
r = atProcessor->openIPBearer(bearerId);
if(r != DCE_OK) {
//return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/Sim900AT.cpp
Expand Up @@ -621,7 +621,7 @@ COMMON_AT_RESULT Sim900AT::startUSSDCall(const char * const ussdRequest, char *
}

//TODO
sleep(10);
PortIO::sleepPort(10);

char * const responce = new char[responceSize];
resFlag &= (portIO->receiveFromPort(responce, responceSize) > 0);
Expand Down Expand Up @@ -1410,7 +1410,7 @@ COMMON_AT_RESULT Sim900AT::setCurrentHTTPAction(const HTTP_ACTION_METHOD &method
delete [] matches;

//TODO timeout or better sleep
sleep(2); /*small delay required!!!*/
PortIO::sleepPort(2); /*small delay required!!!*/
} while (!hasFirstResponce || !hasSecondResponce);

dceResult = DCE_OK;
Expand Down

0 comments on commit 8b00d4c

Please sign in to comment.