package com.cisdi.data.IDCardReader.gateway;

import com.alibaba.fastjson.JSON;
import com.cisdi.data.IDCardReader.gateway.impl.ZKIDROnlineClient;
import com.cisdi.data.IDCardReader.gateway.vo.IDCardVo;
import com.cisdi.data.IDCardReader.gateway.vo.ZKIDROnlineConfigVo;
import com.cisdi.data.sdk.enums.GatewayState;

import java.io.UnsupportedEncodingException;

public class IDCardReaderTest {
    public static void main(String[] args) throws UnsupportedEncodingException
    {
        IDCardVo idCardVo=null;
        try
        {
            idCardVo= JSON.parseObject("{\"Nation\":\"汉\",\"CardNumber\":\"\",\"Base64Photo\":\"/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAB+AGYDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoq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AAAAAAAABcBmsByAP///////74Oovy6GFD+hCm0/Hgyv/yvM6z81jud/I1GAfyqT7r8glPD/MVatPxwZRT8xGpX/vdunPybggf825at/FegyPzAoWL+2ciu/KjWwvzp21P+c+EU/MQJt/2XHBn9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPw=\",\"Address\":\"重庆市长寿区建新中路513号12幢24-2\",\"EnName\":\"\",\"Sex\":\"男\",\"NationCode\":\"1\",\"Birthday\":\"19890909\",\"Base64Image\":\"(null)\",\"Name\":\"叶重阳\",\"ImageName\":\"\",\"CnName\":\"\",\"ValidDate\":\"20360202\",\"CardType\":\"1\",\"PassNum\":\"\",\"VisaTimes\":\"0\",\"PhotoName\":\"C:\\\\Program Files (x86)\\\\ZKIDROnline\\\\bin\\\\zp.bmp\",\"IDNumber\":\"500221198909094019\",\"IDIssued\":\"重庆市公安局长寿分局\",\"IssuedData\":\"20160202\",\"Other\":\"\"}\n",IDCardVo.class);
            idCardVo.getCertificate().setReadID("123123123");
            idCardVo.getCertificate().setReadTime(System.currentTimeMillis()+"");
        }
        catch (Exception e)
        {
            System.out.println(e.getLocalizedMessage());
            //logger.error("连接ID:"+runId+"，设备ID:"+deviceId+"，自动重连设置:"+autoReconnect+"解析数据发生异常:"+e.getLocalizedMessage());
        }
        ZKIDROnlineConfigVo zkidrOnlineConfigVo=new ZKIDROnlineConfigVo();
        zkidrOnlineConfigVo.setUri("ws://10.234.6.254:24012/");
        zkidrOnlineConfigVo.setAutoReconnect(false);
        zkidrOnlineConfigVo.setReconnectDelay(10000L);
        zkidrOnlineConfigVo.setStartMsg("{\"module\":\"idcard\",\"function\":\"autoreadcard\",\"parameter\":{\"dev\":\"1\",\"repeat\":\"1\",\"readtype\":\"1\"}}");
        ZKIDROnlineClient zkidrOnlineClient=new ZKIDROnlineClient("10000000",null,null,zkidrOnlineConfigVo);
//        boolean open = zkidrOnlineClient.start();
//        System.out.println(open);
    }
}
