1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wifi.hotspot2.soap;
18 
19 import android.annotation.NonNull;
20 import android.util.Log;
21 
22 import org.ksoap2.serialization.SoapObject;
23 
24 /**
25  * Represents the sppExchangeComplete message sent by the server.
26  * For the details, refer to A.3.2 section in Hotspot2.0 rel2 specification.
27  */
28 public class ExchangeCompleteMessage extends SppResponseMessage  {
29     private static final String TAG = "PasspointExchangeCompleteMessage";
30 
ExchangeCompleteMessage(@onNull SoapObject response)31     private ExchangeCompleteMessage(@NonNull SoapObject response) throws IllegalArgumentException {
32         super(response, MessageType.EXCHANGE_COMPLETE);
33     }
34 
35     /**
36      * create an instance of {@link ExchangeCompleteMessage}
37      *
38      * @param response SOAP response message received from server.
39      * @return Instance of {@link ExchangeCompleteMessage}, {@code null} in any failure.
40      */
createInstance(@onNull SoapObject response)41     public static ExchangeCompleteMessage createInstance(@NonNull SoapObject response) {
42         ExchangeCompleteMessage exchangeCompleteMessage;
43 
44         try {
45             exchangeCompleteMessage = new ExchangeCompleteMessage(response);
46         } catch (IllegalArgumentException e) {
47             Log.e(TAG, "fails to create an Instance: " + e);
48             return null;
49         }
50         return exchangeCompleteMessage;
51     }
52 }
53