Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DataStore JobScheduler NetworkServices W5500Interface nanopb protocol
Diff: source/jobSchedulesUpload.cpp
- Revision:
- 15:f83485cc5a2c
- Parent:
- 14:65d69aed6540
- Child:
- 16:bef1673b199e
diff -r 65d69aed6540 -r f83485cc5a2c source/jobSchedulesUpload.cpp --- a/source/jobSchedulesUpload.cpp Thu Aug 03 18:15:49 2017 +0000 +++ b/source/jobSchedulesUpload.cpp Thu Aug 03 19:04:06 2017 +0000 @@ -65,6 +65,7 @@ this->_scheduler.AppointmentList(apts); node<JobScheduler::Appointment>* aptn = apts.pop(1); int idx = 0; + pbJobs.items_count = 0; while (aptn != NULL) { JobScheduler::Appointment* apt = aptn->data; JobScheduler::Job* job = apt->GetJob(); @@ -79,6 +80,7 @@ } tr_debug("schedule data size: %d", pbJobs.items[idx].ScheduleData.size); // pbJobs.items[idx].Data = + pbJobs.items_count = idx; apts.remove(1); aptn = apts.pop(1); @@ -86,6 +88,15 @@ } } + pb_ostream_t sizeStream = {0}; + pb_encode(&sizeStream, protocol_JobList_fields, &pbJobs); + tr_debug("JobsList payload size: %d", sizeStream.bytes_written); + + uint8_t* outBuf = new uint8_t[sizeStream.bytes_written]; + pb_ostream_t outStream = pb_ostream_from_buffer(outBuf, sizeof(outBuf)); + pb_encode(&outStream, protocol_JobList_fields, &pbJobs); + delete outBuf; + // protocol_Job job; // time_t now = time(NULL); //tr_debug("ADC created time is: %s\n", ctime(&now));