Skip to content

Commit

Permalink
changed creating a timer
Browse files Browse the repository at this point in the history
  • Loading branch information
sagIoTPower committed May 14, 2024
1 parent 6ea08bf commit ae30424
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions repository/blocks/EnhancedHttpOutputBlock.mon
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ event HTTPHandler
{
string deviceId;
string host;
BlockBase base;
/** Handle the HTTP response.*/
action handleResponse(Response res) {
// $base.createTimer(0.01, res); // Creates a timer with the specified duration.
TimerParams tp := TimerParams.relative(0.01).withPayload(res).withPartition(deviceId);
// TimerParams tp := TimerParams.relative(0.01).withPayload(res).withPartition(deviceId);
base.relative(0.01).withPayload(res).withPartition(deviceId);

log "Called handleResponse: " + res.payload.data.toString() at INFO;
if not res.isSuccess() {
Expand Down Expand Up @@ -186,7 +188,7 @@ event EnhancedHTTPOutput {
// Execute the request and pass the callback action.
string deviceId := $activation.partition.toString();
log "Processing for partition: " + deviceId at INFO;
req.execute(HTTPHandler(deviceId, $parameters.host).handleResponse);
req.execute(HTTPHandler(deviceId, $parameters.host, $base).handleResponse);
$base.profile(BlockBase.PROFILE_OUTPUT);
}

Expand Down

0 comments on commit ae30424

Please sign in to comment.