C# Cluster Communication Help needed

Programs / Tools / Scripts
megajuz3003
Posts: 74
Joined: Sun Aug 26, 2012 9:47 pm
cars: 2001 VU SS
Location: Brisbane

Re: C# Cluster Communication Help needed

Post 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
User avatar
antus
Site Admin
Posts: 8237
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: C# Cluster Communication Help needed

Post 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.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
commodorenut
Posts: 58
Joined: Sun Jan 01, 2017 7:50 pm
cars: VY Monaro 427ci SuperCharged
VK Group A LS2 671 Supercharged ( in the build )

Re: C# Cluster Communication Help needed

Post 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
User avatar
commodorenut
Posts: 58
Joined: Sun Jan 01, 2017 7:50 pm
cars: VY Monaro 427ci SuperCharged
VK Group A LS2 671 Supercharged ( in the build )

Re: C# Cluster Communication Help needed

Post 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 ).
megajuz3003
Posts: 74
Joined: Sun Aug 26, 2012 9:47 pm
cars: 2001 VU SS
Location: Brisbane

Re: C# Cluster Communication Help needed

Post 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
User avatar
commodorenut
Posts: 58
Joined: Sun Jan 01, 2017 7:50 pm
cars: VY Monaro 427ci SuperCharged
VK Group A LS2 671 Supercharged ( in the build )

Re: C# Cluster Communication Help needed

Post 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#
User avatar
antus
Site Admin
Posts: 8237
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: C# Cluster Communication Help needed

Post 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.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
megajuz3003
Posts: 74
Joined: Sun Aug 26, 2012 9:47 pm
cars: 2001 VU SS
Location: Brisbane

Re: C# Cluster Communication Help needed

Post 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
User avatar
antus
Site Admin
Posts: 8237
Joined: Sat Feb 28, 2009 8:34 pm
cars: TX Gemini 2L Twincam
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Contact:

Re: C# Cluster Communication Help needed

Post by antus »

This would be the most detail thread around:
viewtopic.php?f=10&t=219
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
User avatar
commodorenut
Posts: 58
Joined: Sun Jan 01, 2017 7:50 pm
cars: VY Monaro 427ci SuperCharged
VK Group A LS2 671 Supercharged ( in the build )

Re: C# Cluster Communication Help needed

Post 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
Post Reply