Skip to content

Commit

Permalink
server working
Browse files Browse the repository at this point in the history
  • Loading branch information
joaocarvoli committed Jul 11, 2022
1 parent b9e583f commit 449bb42
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 28 deletions.
10 changes: 5 additions & 5 deletions client/client_Udp/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public ClientProxy( String host, int portNumber ) {
client = new ClientUDP(host, portNumber);
count = 1;

// this.convert("USD", "BRL", (float) 5.068 );
// this.currencyExists( "CAD" );
this.convert("USD", "BRL", (float) 5.068 );
this.currencyExists( "CAD" );
// this.currencysAvailable();
// this.getWheaterTemperature("Mountain View");
// this.getWheaterClouds("Mountain View");
// this.getWheaterWind("Mountain View");
this.getWheaterTemperature("Mountain View");
this.getWheaterClouds("Mountain View");
this.getWheaterWind("Mountain View");

}catch( Exception e ) {
System.out.println("ClientProxy error: " + e.getMessage());
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion server/Dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def invoke(self, message: Message) -> json:
response = sk_cc.currency_exists(message.get_arguments())
message.set_message_type(1)
message.set_arguments(response)

elif message.get_method_name() == 'currencies_available':
response = sk_cc.currencies_available()
message.set_message_type(1)
Expand All @@ -35,11 +36,12 @@ def invoke(self, message: Message) -> json:
response = sk_wt.get_weather_clouds(message.get_arguments())
message.set_message_type(1)
message.set_arguments(response)

elif message.get_method_name() == 'get_weather_temperature':
response = sk_wt.get_weather_temperature(message.get_arguments())
message.set_message_type(1)
message.set_arguments(response)
message.set_message_type(1)

elif message.get_method_name() == 'get_weather_wind':
response = sk_wt.get_weather_wind(message.get_arguments())
message.set_message_type(1)
Expand Down
2 changes: 0 additions & 2 deletions server/skeletons/CurrencyConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def convert(self, args: list):
result = result.replace('{', '')
result = result.replace('}', '')
result = result.replace("'", '')
print(result)
response = list()
response.append(result)
return response
Expand All @@ -38,7 +37,6 @@ def currencies_available(self):
for i, currency in enumerate(result):
string = 'currency:' + currency
response.append(string)
print(response)
return response


Expand Down
9 changes: 3 additions & 6 deletions server/skeletons/Weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class Weather:
def get_weather_temperature(self, args: list):

params = get_params(args)
city = params['city']
self.tempoUser = ServiceWeather.WeatherCity(city)
Expand All @@ -21,8 +20,7 @@ def get_weather_temperature(self, args: list):
response.append(result)
return response

def get_weather_clouds(self , args: list):

def get_weather_clouds(self, args: list):
params = get_params(args)
city = params['city']
self.tempoUser = ServiceWeather.WeatherCity(city)
Expand All @@ -40,7 +38,6 @@ def get_weather_clouds(self , args: list):
return response

def get_weather_wind(self, args: list):

params = get_params(args)
city = params['city']
self.tempoUser = ServiceWeather.WeatherCity(city)
Expand All @@ -58,11 +55,11 @@ def get_weather_wind(self, args: list):
response.append(result)
return response

#pega o nome da cidade e coloca em params

# pega o nome da cidade e coloca em params
def get_params(args: list):
params = {}
for i in args:
param, value = i.split(':')
params[param] = value
return params

0 comments on commit 449bb42

Please sign in to comment.