Skip to content
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

Ajouter la vérification du checksum de trame #5

Open
Charlymd opened this issue Aug 25, 2020 · 1 comment
Open

Ajouter la vérification du checksum de trame #5

Charlymd opened this issue Aug 25, 2020 · 1 comment

Comments

@Charlymd
Copy link

chaque trame dispose d'une étiquette, d'une donnée et d'un caractère de controle.
la documentation ENEDIS (Enedis-NOI-CPT_54E) explique la méthode de calcul de ce checksum
exemple : HCHP 000320792 *
-> ici le * correspond au checksum

ajouter un calcul de checksum et le comparer à celui contenu dans la trame pour vérifier l'intégrité de celle-ci

@Charlymd
Copy link
Author

def calc_checksum(group):
data_unicode = 0
for data in group:
data_unicode += ord(data)
sum_unicode = (data_unicode & 63) + 32
sum = chr(sum_unicode)
return sum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant