package cn.net.test;

import java.io.IOException;
import java.net.BindException;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;

import cn.net.cpzslibs.prot.Prot02Logout;
import cn.net.cpzslibs.prot.SocketCreate;
import cn.net.cpzslibs.prot.handset.Prot36CarGetInfo;

public class Handset36Car {

	/**
	 * <br/>
	 * 2015-7-14上午11:27:07
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		SocketCreate create = new SocketCreate("192.168.0.46", 8898, "358000052");
		try {
			create.createLoginCpzsHandset(358000052L);// 汽配
			System.out.println(create.getiCompanyId() + "---" + create.getiWorkStyle());
			Prot36CarGetInfo carGetInfo = new Prot36CarGetInfo();
			carGetInfo.dealProt(create, "京6665551");
			if(carGetInfo.isSuccess()){
				String json = carGetInfo.getJson();
				System.out.println("json:" + json);
				System.out.println(carGetInfo.getCarInfo().toString());
			}else{
				System.out.println(carGetInfo.getiRecErrcode());
			}
		} catch (BindException e) {
			e.printStackTrace();
		} catch (ConnectException e) {
			e.printStackTrace();
		} catch (SocketTimeoutException e) {
			e.printStackTrace();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			new Prot02Logout().dealLogout(create);
		}

	}

}
