async function copy_StatusData() {
    const dateType_StatusData = 'StatusData';
    let fromVersion = await loadFromVersion(dateType_StatusData);

    let iterationsLeft = DEBUG_ITERATIONS_LIMIT;
    do {
        let result = await readGeotabRecords(dateType_StatusData, fromVersion);
        if (Array.isArray(result.data) && result.data.length > 0) {
            fromVersion = result.toVersion;
            let statusCode = await post_StatusData(result.data);
            console.info(`Got SAP status code: ${statusCode}\n`);
            await storeFromVersion(dateType_StatusData, fromVersion);
        } else {
            // The fetch returned no records, wait to reduce the polling load
            await sleep(POLLING_DELAY_MS);
        }
    } while (DEBUG_ITERATIONS_LIMIT <= 0 || --iterationsLeft > 0);
}
/**
 * Poll Geotab for records of typeName 'StatusData' and POST them to IoT Service.
 *
 * See the comments in the body of {@link copy_LogRecords}. This function is very similar,
 * but kept separate for simplicity in this sample code.
 */
Poll Geotab for records of typeName 'StatusData' and POST them to IoT Service.
See the comments in the body of  copy_LogRecords. This function is very similar,
but kept separate for simplicity in this sample code.
Poll Geotab for records of typeName ' StatusData ' and POST them to IoT Service . See the comments in the body of copy_LogRecords . This function is very similar but kept separate for simplicity in this sample code .
async function copy_StatusData() {
    const dateType_StatusData = 'StatusData';
    let fromVersion = await loadFromVersion(dateType_StatusData);
    let iterationsLeft = DEBUG_ITERATIONS_LIMIT;
    do {
        let result = await readGeotabRecords(dateType_StatusData, fromVersion);
        if (Array.isArray(result.data) && result.data.length > 0) {
            fromVersion = result.toVersion;
            let statusCode = await post_StatusData(result.data);
            console.info(`Got SAP status code: ${statusCode}\n`);
            await storeFromVersion(dateType_StatusData, fromVersion);
        } else {
            await sleep(POLLING_DELAY_MS);
        }
    } while (DEBUG_ITERATIONS_LIMIT <= 0 || --iterationsLeft > 0);
}
async function copy_StatusData ( ) { const dateType_StatusData = 'StatusData' ; let fromVersion = await loadFromVersion ( dateType_StatusData ) ; let iterationsLeft = DEBUG_ITERATIONS_LIMIT ; do { let result = await readGeotabRecords ( dateType_StatusData , fromVersion ) ; if ( Array . isArray ( result . data ) && result . data . length > 0 ) { fromVersion = result . toVersion ; let statusCode = await post_StatusData ( result . data ) ; console . info ( ` ${ statusCode } \n ` ) ; await storeFromVersion ( dateType_StatusData , fromVersion ) ; } else { await sleep ( POLLING_DELAY_MS ) ; } } while ( DEBUG_ITERATIONS_LIMIT <= 0 || -- iterationsLeft > 0 ) ; }
Poll Geotab for records of typeName 'StatusData' and POST them to IoT Service.
Poll Geotab for records of typeName ' StatusData ' and POST them to IoT Service .
// The fetch returned no records, wait to reduce the polling load