Page 2 of 4

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:00 pm
by megajuz3003
I think it should be defined as Byte() then sent F2, 57, 4, 0, B3

at least from the research I've been doing... can I ask what made you choose C# it looks like everyone on here uses VB

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:04 pm
by antus
Yes, they are all the same on the wire. Your thinking like a human. Byte array is the most appropriate.

As for the receive, your dump looks like blocks of read data, not ALDL packets. Next step is to read the headers, sync up, and assemble that data stream in to packets. There is no start byte or stop byte, so its a bit tricky. Generally you do a read, let it fail, to identify silence then try and read the device and length from the next packet then wait for the rest of the frame to come in and then handle it appropriately.

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:15 pm
by commodorenut
antus wrote:Yes, they are all the same on the wire. Your thinking like a human. Byte array is the most appropriate.

As for the receive, your dump looks like blocks of read data, not ALDL packets. Next step is to read the headers, sync up, and assemble that data stream in to packets. There is no start byte or stop byte, so its a bit tricky. Generally you do a read, let it fail, to identify silence then try and read the device and length from the next packet then wait for the rest of the frame to come in and then handle it appropriately.

OMG antus after reading that i need to go take 10 panadol..lol

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:19 pm
by commodorenut
megajuz3003 wrote:I think it should be defined as Byte() then sent F2, 57, 4, 0, B3

at least from the research I've been doing... can I ask what made you choose C# it looks like everyone on here uses VB

Honestly i dont know why i chose c#

I was told you can do alot more with C# over VB ( i dont know how true that is thou ).

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:26 pm
by megajuz3003
commodorenut wrote:
Honestly i dont know why i chose c#

I was told you can do alot more with C# over VB ( i dont know how true that is thou ).

fair enough :) I've only ever done basic apps is VB and C# (PHP and SQL is another story did that for work for 8 years), so that's why I was asking,

I'm still trying to "decode" the tables so I can actually pull the data and turn it into something usable :D

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:35 pm
by commodorenut
megajuz3003 wrote:
commodorenut wrote:
Honestly i dont know why i chose c#

I was told you can do alot more with C# over VB ( i dont know how true that is thou ).

fair enough :) I've only ever done basic apps is VB and C# (PHP and SQL is another story did that for work for 8 years), so that's why I was asking,

I'm still trying to "decode" the tables so I can actually pull the data and turn it into something usable :D

Im quite good with Coldfusion, But wow c# is totally different in everyway..

This is my second week with c#

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:37 pm
by antus
Are you familiar with the ALDL format? Eg

F2 57 04 00 B3 is:

Device: F2
Length: 57 (57-52=5 Byte packet)
Mode: 04 (type of command)
Mode2: 00 (sorry dont know the correct name, really a paramater to the mode command)
Checksum: B3

So you Read 2 bytes to get as far as the length, Then you know total length is 5, so read 3 more bytes. Then calculate and check the checksum (discard if you calculate B3 but the last byte is not B3). Then check if your handling packets for device F2, and if so go to your handler for mode 4, and it can read 00 and do the appropriate thing.

Having said that, F2 is the dash so your sending it not receiving it, but the concept to read an ALDL packet is about right.

Sorry if this is not clear.

C# is a good language, but your going to need to understand ALDL to structure your app the right way. But if its your first app just jump right in and it'll become clear as you go. In my work as a software dev we have always said "write the first one to throw away" as an investigation exercise.

C# is an object orientated language, so its designed to be written a certain way. If you dont know OO it might be worth reading something general or something which explains that to get an idea of the app layout.

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:46 pm
by megajuz3003
antus wrote:Mode2: 00 (sorry dont know the correct name, really a paramater to the mode command)
.. ive been calling that a Table :lol: probably not right either but it makes sense to me, im sifting through posts here, just commodore and google , as well as playing with spare parts on a bench harness and trying to collate it all into a single document but I'm starting to get a better understanding of how it all works

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 4:58 pm
by antus
This would be the most detail thread around:
viewtopic.php?f=10&t=219

Re: C# Cluster Communication Help needed

Posted: Tue Nov 14, 2017 5:12 pm
by commodorenut
antus wrote:Are you familiar with the ALDL format? Eg

F2 57 04 00 B3 is:

Device: F2
Length: 57 (57-52=5 Byte packet)
Mode: 04 (type of command)
Mode2: 00 (sorry dont know the correct name, really a paramater to the mode command)
Checksum: B3

So you Read 2 bytes to get as far as the length, Then you know total length is 5, so read 3 more bytes. Then calculate and check the checksum (discard if you calculate B3 but the last byte is not B3). Then check if your handling packets for device F2, and if so go to your handler for mode 4, and it can read 00 and do the appropriate thing.

Having said that, F2 is the dash so your sending it not receiving it, but the concept to read an ALDL packet is about right.

Sorry if this is not clear.

C# is a good language, but your going to need to understand ALDL to structure your app the right way. But if its your first app just jump right in and it'll become clear as you go. In my work as a software dev we have always said "write the first one to throw away" as an investigation exercise.

C# is an object orientated language, so its designed to be written a certain way. If you dont know OO it might be worth reading something general or something which explains that to get an idea of the app layout.


Ok this string here which i read from the tech 2 will move the fuel guage to half...

F2, 83, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7F, 0, 0, 4, [ check sum ]

checked and works on the OSE tool

so with check sum should be 87