@@ -51,10 +51,19 @@ class NetworkClient {
5151 HttpOverrides .global = new SelfSignedHttpAgent ();
5252 }
5353
54- static String buildUrl (final ip, final token) {
54+ static String buildUrl (final ip, final token, final legacyParser, final gaussian, final grayscale, final rotate ) {
5555 if (token == null || token == "" )
56- return _protocol + ip + ":" + _port + _path;
57- return _protocol + ip + ":" + _port + _path + _access_token + token;
56+ return _protocol + ip + ":" + _port + _path + "&legacy_parser=" + getValue (legacyParser) + "&grayscale_image=" + getValue (grayscale) + "&gaussian_blur=" + getValue (gaussian) + "&rotate=" + getValue (rotate);
57+ return _protocol + ip + ":" + _port + _path + _access_token + token + "&legacy_parser=" + getValue (legacyParser) + "&grayscale_image=" + getValue (grayscale) + "&gaussian_blur=" + getValue (gaussian) + "&rotate=" + getValue (rotate);
58+ }
59+
60+ /// Convert boolean values to python boolean values
61+ static String getValue (final bool val) {
62+ if (val == null || val == false ) {
63+ return "False" ;
64+ } else {
65+ return "True" ;
66+ }
5867 }
5968
6069 static toNavigationBar (BuildContext context) {
@@ -63,8 +72,16 @@ class NetworkClient {
6372 }
6473
6574 /// Send image via post request to the server and capture the response.
66- static sendImage (File imageFile, String ip, String token,
67- bool sendDebugOutput, BuildContext context,
75+ static sendImage (
76+ File imageFile,
77+ String ip,
78+ String token,
79+ bool sendDebugOutput,
80+ bool grayscale,
81+ bool gaussian,
82+ bool legacyParser,
83+ bool rotate,
84+ BuildContext context,
6885 [GlobalKey <ScaffoldState > key]) async {
6986 init ();
7087
@@ -86,7 +103,7 @@ class NetworkClient {
86103 stream.cast ();
87104
88105 var length = await imageFile.length ();
89- var uri = Uri .parse (buildUrl (ip, token));
106+ var uri = Uri .parse (buildUrl (ip, token, legacyParser, gaussian, grayscale, rotate ));
90107
91108 log (uri.toString ());
92109
0 commit comments