Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

You are here: Forum Home → ANT+ Forums → ANT+ Bike Power → Thread

   

How get serial number from common page

RankRank

Total Posts: 33

Joined 0

PM

Hi,
I implemented the power profile in my vb.net software.
I want to show the serial number of the power hardware.
But i have some problems to decode the page 81. The profile give me no anwer for this.
I have some problems with translating the byte shifting way in C++ to vb.net.
I now that i use the latest 4 bytes, in the C++ code you need >>24.
Is this the same as 16777216?? When i convert the c++ code to vb.net i get a value that not fit in an ulong.
Does anyone have an example in C# or in vb.net to get the serial number from page 81?

Thanks

Best Regards
Klaasjan
     
RankRankRankRank

Total Posts: 156

Joined 2013-01-07

PM

Hi,

Since you have a generic programming question about obtaining a uint from four bytes using VB.net, I would recommend asking the question on a programming forum (StackOverflow, etc.).

We primarily use C# for our applications so I have included the code we use for obtaining a uint from four bytes:

internal static uint GetUint(byte byte0, byte byte1, byte byte2, byte byte3)
{
uint result = byte0;
result |= (uint)(((uint)byte1 & 0xFF) << 8);
result |= (uint)(((uint)byte2 & 0xFF) << 16);
result |= (uint)(((uint)byte3 & 0xFF) << 24);
return result;
}

Regards,
Usama      
RankRank

Total Posts: 33

Joined 0

PM

Hi,

Thank you for your answer.
I found the solution, It was a wrong translation from me. It is what you write namely adding the values together.

Best Regards,
Klaasjan