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

calculated CRC16 ARC #11

Closed
yusmi25 opened this issue Apr 9, 2021 · 6 comments
Closed

calculated CRC16 ARC #11

yusmi25 opened this issue Apr 9, 2021 · 6 comments

Comments

@yusmi25
Copy link

yusmi25 commented Apr 9, 2021

can I calculate the CRC16 ARC with this package
I have a data [0x0E 0x20 0xE0 0x07 0xA5 0x03 0x00 0x00 0x2E 0x46 0x49 0x54] and I want to calculate the CRC16
when I insert the data on the CRC Calculator the result is 0xA447
thanks..

@postmasters
Copy link
Collaborator

Yes. That function is available in the catalog. Please see

class Crc16Arc extends ParametricCrc {
.

@yusmi25
Copy link
Author

yusmi25 commented Apr 9, 2021

can you create the example, because I don't understand how to use this
thank you..

@postmasters
Copy link
Collaborator

Something like this:

import 'package:crclib/catalog.dart';

Uint8List input = ...;
BigInt v = Crc16Arc().convert(input).toBigInt();

@yusmi25
Copy link
Author

yusmi25 commented Apr 9, 2021

import 'package:crclib/crclib.dart';
import 'package:crclib/catalog.dart';

import 'package:crclib/catalog.dart';

void main() {
List input = [10, 20, 30];
BigInt v = Crc16Arc().convert(input).toBigInt();
print(v);
}

error on the toBigInt();

@postmasters
Copy link
Collaborator

I see. You are using the published package. In that case, you can call toString, or toRadixString to produce a String representation of the CrcValue. The method toBigInt is currently in main branch and not yet published via pub.

@yusmi25
Copy link
Author

yusmi25 commented Apr 9, 2021

List input = [14, 32, 224, 07, 165, 03, 00, 00, 46, 70, 73, 84];
print(Crc16Arc().convert(input).toRadixString(16)); // result a447
thank you it solve my problem :D

@yusmi25 yusmi25 closed this as completed Apr 9, 2021
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

2 participants