示例#1
0
    private int ModifyPersonInfoUSB(int enroll_id, int device_id)
    {
        AnvizNew.PERSONINFO person = new AnvizNew.PERSONINFO();
        byte[] nms = Encoding.ASCII.GetBytes("");
        byte[] pss = Encoding.Default.GetBytes("");
        int    final_status = 0, status = 0, i = 0;
        int    pLongRun = new int();

        if (AnvizNew.CKT_ChangeConnectionMode(0) != 1)
        {
        }

        status = AnvizNew.CKT_RegisterUSB(device_id, 0);
        if (status != 0)
        {
            person.CardNo = 5216455;
            person.Name   = new byte[12];

            for (i = 0; i < 12; i++)
            {
                if (i < pss.Length)
                {
                    person.Name[i] = pss[i];
                    continue;
                }
                person.Name[i] = 0;
            }

            person.Password = new byte[8];

            for (i = 0; i < 8; i++)
            {
                if (i < nms.Length)
                {
                    person.Password[i] = nms[i];
                    continue;
                }
                person.Password[i] = 0;
            }
            person.PersonID = enroll_id;
            person.KQOption = 6;
            person.Group    = 1;

            final_status = AnvizNew.CKT_ModifyPersonInfo(device_id, ref person);

            // NOTE: Below section has been commented on purpose. Please uncomment after adding the code for LOGGING errors.

            /*switch (final_status) {
             *
             * case 1:
             * case -1:
             * default:
             *  //TODO: Add logic for LOGGING here.
             *  break;
             * }*/
        }

        return(final_status);
    }
示例#2
0
    public int connectanvizdevice(int device_id, string device_ip, string communication_type)
    {
        int status = 0;

        switch (communication_type)
        {
        case "LAN":
            if (AnvizNew.CKT_ChangeConnectionMode(0) != 1)
            {
            }
            status = AnvizNew.CKT_RegisterNet(device_id, device_ip);
            break;

        case "WAN":
            int pLongRun = new int();
            if (AnvizNew.CKT_ChangeConnectionMode(1) != 1)
            {
            }
            status = AnvizNew.CKT_NetDaemonWithPort(5010);
            if (status == 1)
            {
                Thread.Sleep(5000);
                status = AnvizNew.CKT_GetClockingRecordEx(device_id, ref pLongRun);
            }
            break;

        case "USB":
            if (AnvizNew.CKT_ChangeConnectionMode(0) != 1)
            {
            }
            status = AnvizNew.CKT_RegisterUSB(device_id, 0);
            break;

        case "DNS":
            if (AnvizNew.CKT_ChangeConnectionMode(0) != 1)
            {
            }
            IPAddress[] addresslist = Dns.GetHostAddresses(device_ip);
            device_ip = Convert.ToString(addresslist[0]);
            status    = AnvizNew.CKT_RegisterNet(device_id, device_ip);
            break;
        }

        return(status);
    }