package com.example.edssampleapp;

.....
import com.example.edssdkclient.BuildConfig;
import com.example.edssdkclient.edsSdkCallback;
import com.example.edssdkclient.edsSdkClient;
import com.example.edssdkclient.edsSdkRspMsg;



public class MainActivity extends AppCompatActivity {

   
    public String selectedAppSrv_str = "cvonvif";
    public String mecEndpoint_default = "simpm.thingspace.verizon.com";
    String edsLibVersion =  null;
    int timeout_ms = 3000;
    final String TAG = "sampleApp"

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

       

        //Create EDS Client Object
        edsSdkClient edsClient = new edsSdkClient(MainActivity.this);

        //Set EDS Client callback
        edsClient.setEdsClientCallback(new edsSdkCallback() {
            @Override
            public void onSuccessResponse(edsSdkRspMsg msg) {
                Log.d(TAG, "onSuccessResponse: ");
                 runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Log.d(TAG, "onSuccessResponse msgType: "+msg.msgType);
                        if(msg.msgType == edsSdkRspMsg.msg_type.EDS_ENDPOINT_SUCCESS_RSP) {
                            //Print the data of output
                            
                        }
                    }
                });
            }

            @Override
            public void onFailureResponse(edsSdkRspMsg msg) {
                Log.d(TAG, "onFailureResponse: ");
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        if(msg.msgType == edsSdkRspMsg.msg_type.EDS_ENDPOINT_FAILURE_RSP) {
                            Log.d(TAG, "onFailureResponse: use default endpoints");
                            
                        }
                    }
                });
            }
        });

        //Get EDS SDK Lib version
        edsLibVersion = edsClient.getEdsSdkLibVersion();
        Log.d(TAG, "edsSdkLibVersion: "+edsLibVersion);
        
        //Send the request to sdk for optimal MEC endpoints
        boolean rc = true;
        rc = edsClient.sendOptimalMECEndpointReq(selectedAppSrv_str, timeout_ms)
        if (rc) {
               Log.d(TAG, "Request sent successfully");
        } else {
               Log.d(TAG, "Failure use default endpoints");
        }
    }
       
}

    