Пример #1
0
        public override byte[] ProcessCommandApdu(byte[] commandApdu, Bundle extras)
        {
            Log.Info(TAG, "Received APDU: " + ByteArrayToHexString(commandApdu));
            // If the APDU matches the SELECT AID command for this service,
            // send the employee ID number, followed by a SELECT_OK status trailer (0x9000)

            // Check if the values inside of commandApdu are the same as SELECT_APDU
            bool arrayEquals;

            if (SELECT_APDU.Length == commandApdu.Length)
            {
                arrayEquals = true;
                for (int i = 0; i < SELECT_APDU.Length; i++)
                {
                    if (SELECT_APDU[i] != commandApdu[i])
                    {
                        arrayEquals = false;
                        break;
                    }
                }
            }
            else
            {
                arrayEquals = false;
            }

            if (arrayEquals)
            {
                String employee      = EmployeeStorage.GetEmployee(this);
                byte[] employeeBytes = Encoding.UTF8.GetBytes(employee);
                //Log.Info(TAG, "Sending employee number: " + employee);
                return(ConcatArrays(employeeBytes, SELECT_OK_SW));
            }
            else
            {
                return(UNKNOWN_CMD_SW);
            }
        }
Пример #2
0
 public EmployeesController(IConfiguration config)
 {
     _storage = new EmployeeStorage(config);
 }
Пример #3
0
 public EmployeeController(DatabaseInterface db)
 {
     _db       = db;
     _Employee = new EmployeeStorage(db);
 }