public Channel NextChannel() { Channel next_channel; //non standard usage of for loop construct. It works.... for (channel_enumerator++; channel_enumerator < enumerator_max; channel_enumerator++) { switch (channel_enumerator) { case 0: next_channel = device.ConstructChannel(J2534PROTOCOL.ISO15765, J2534BAUD.ISO15765, J2534CONNECTFLAG.NONE); if (next_channel.IsOpen) { return(next_channel); } break; case 1: next_channel = device.ConstructChannel(J2534PROTOCOL.J1850PWM, J2534BAUD.J1850PWM, J2534CONNECTFLAG.NONE); if (next_channel.IsOpen) { return(next_channel); } break; case 2: next_channel = device.ConstructChannel(J2534PROTOCOL.J1850VPW, J2534BAUD.J1850VPW, J2534CONNECTFLAG.NONE); if (next_channel.IsOpen) { return(next_channel); } break; case 3: default: //Should I include the 5 baud init here? next_channel = device.ConstructChannel(J2534PROTOCOL.ISO9141, J2534BAUD.ISO9141, J2534CONNECTFLAG.NONE); if (next_channel.IsOpen) { return(next_channel); } break; } } return(null); }
public ISO15765_Session(J2534Device Device) { this.device = Device; channel = device.ConstructChannel(J2534PROTOCOL.ISO15765, J2534BAUD.ISO15765, J2534CONNECTFLAG.NONE); if (channel.IsOpen) //If channel is constructed successfully and is live { InitializeDefaultConfigs(); } }