forked from SkippyZA/ibt-telemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
const { Telemetry } = require('./telemetry'); | ||
const { Telemetry } = require('./telemetry') | ||
|
||
module.exports = async function (context, req) { | ||
try { | ||
// Check if there is content in the request body | ||
if (!req.rawBody) { | ||
throw new Error('No file uploaded.'); | ||
throw new Error('No file uploaded.') | ||
} | ||
|
||
// The binary data of the .ibt file is contained in req.rawBody | ||
const telemetryData = req.rawBody; | ||
const telemetryData = req.rawBody | ||
|
||
// Process telemetry | ||
const telemetry = new Telemetry(telemetryData); | ||
console.log(telemetry.header); | ||
const telemetry = new Telemetry(telemetryData) | ||
console.log(telemetry.header) | ||
|
||
// Response | ||
context.res = { | ||
status: 200, | ||
body: 'Telemetry data processed.' | ||
}; | ||
} | ||
} catch (error) { | ||
context.res = { | ||
status: 500, | ||
body: `Error: ${error.message}` | ||
}; | ||
} | ||
} | ||
}; | ||
} |