Skip to content

Convert Hexa to ASCII in progress logs #429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 1110
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/store/modules/Logs/PostCodeLogsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ const PostCodeLogsStore = {
Members = Members.filter((log) => log.MessageArgs[3] !== '00000000');
const postCodeLogs = Members.map((log) => {
const { Created, MessageArgs, AdditionalDataURI } = log;
let asciiString = '';
let hexString = MessageArgs[2];
for (let i = 0; i < hexString.length; i += 2) {
const hexPair = hexString.substring(i, i + 2);
const decimalValue = parseInt(hexPair, 16);
asciiString += String.fromCharCode(decimalValue);
}
return {
date: new Date(Created),
bootCount: MessageArgs[0],
timeStampOffset: MessageArgs[1],
postCode: MessageArgs[3],
postCode: asciiString,
uri: AdditionalDataURI,
};
});
Expand Down