Esempio n. 1
0
        // Annex A.7: Helper procedure to check free storage for additional credential
        public static CredentialAndState[] CheckFreeStorageForCredentialA7(this ICredentialService s, List <Credential> lstCredential)
        {
            CredentialAndState[] arrCrSt = new CredentialAndState[0];

            //1. ONVIF Client gets the service capabilities (out cap) by following the procedure mentioned in Annex A.2.
            var cap = s.GetServiceCapabilities();

            //3. If number of items of credentialCompleteList less than cap.MaxCredential, skip other steps.
            if (lstCredential.Count < cap.MaxCredentials)
            {
                return(arrCrSt);
            }

            //4. If number of items at credentialCompleteList equal to cap.MaxCredentials, execute the following steps:
            if (lstCredential.Count == cap.MaxCredentials)
            {
                //4.1. ONVIF client invokes GetCredentials with parameters
                Credential[] arrCr = s.GetCredentials(new string[] { lstCredential[0].token });

                Array.Resize <CredentialAndState>(ref arrCrSt, 1);
                arrCrSt[0].credential = arrCr[0];
                arrCrSt[0].state      = s.GetCredentialState(arrCr[0].token);

                //4.3. ONVIF Client deletes the Credential (in credentialCompleteList[0].token) by following the procedure mentioned in Annex A.6
                s.DeleteCredential(arrCr[0].token);
            }
            else
            {
                s.Test.Assert(false, "No free storage space for credential", "Check free storage for credentials");
            }

            return(arrCrSt);
        }
Esempio n. 2
0
 // Annex A.7: Helper procedure to check free storage for additional credential
 public static void RestoreCredentialsA10(this ICredentialService s, CredentialAndState credentialAndState)
 {
     credentialAndState.credential.token = "";
     s.CreateCredential(credentialAndState.credential, credentialAndState.state);
 }