Exemplo n.º 1
0
        public TireStates GetTireState(string VehicleId, string access_token)
        {
            var client  = new RestClient("https://api.mercedes-benz.com/experimental/connectedvehicle/v1/vehicles/" + VehicleId + "/tires");
            var request = new RestRequest(Method.GET);

            request.AddHeader("Authorization", "Bearer " + access_token);
            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Accept", "application/json");
            IRestResponse response = client.Execute(request);

            TireStates JSONObj = JsonConvert.DeserializeObject <TireStates>(response.Content);

            return(JSONObj);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    VehicleInformation getVehicleInformation = new VehicleInformation();
                    TireStates         getTireStates         = new TireStates();
                    Location           getLocation           = new Location();
                    Odometer           getOdometer           = new Odometer();
                    FuelState          getFuelState          = new FuelState();
                    StateOfCharge      getStateOfCharge      = new StateOfCharge();
                    StateOfDoors       getStateOfDoors       = new StateOfDoors();

                    if (Request.QueryString["code"] != null)
                    {
                        string Access_token = VerifyAuthentication(Request.QueryString["code"]);
                        string VehicleId    = GetVehicleId(Access_token);
                        getVehicleInformation = GetVehicleInformationById(VehicleId, Access_token);
                        getTireStates         = GetTireState(VehicleId, Access_token);
                        getLocation           = GetLocation(VehicleId, Access_token);
                        getOdometer           = GetOdometer(VehicleId, Access_token);
                        getFuelState          = GetFuelState(VehicleId, Access_token);
                        getStateOfCharge      = GetStateOfCharge(VehicleId, Access_token);
                        getStateOfDoors       = GetStateOfDoors(VehicleId, Access_token);
                        string kapidurum = SetLockStateOfDoors(VehicleId, Access_token);
                        if (kapidurum == "INITIATED")
                        {
                        }
                        else
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }