mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-17 10:30:03 +02:00
wip
This commit is contained in:
parent
3eb2e67cdf
commit
ccd497d10d
|
@ -37,6 +37,9 @@
|
|||
<uses-permission android:name="me.hackerchick.catima.READ_CARDS"/>
|
||||
<uses-permission android:name="me.hackerchick.catima.debug.READ_CARDS"/>
|
||||
|
||||
<!-- Internet Helper -->
|
||||
<uses-permission android:name="nodomain.freeyourgadget.internethelper.INTERNET"/>
|
||||
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_CALENDAR" />
|
||||
<uses-permission
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package nodomain.freeyourgadget.internethelper;
|
||||
|
||||
interface IFtpService {
|
||||
int version();
|
||||
|
||||
String createClient();
|
||||
void destroyClient(String client);
|
||||
|
||||
void connect(String client, String host, int port);
|
||||
void disconnect(String client);
|
||||
|
||||
void login(String client, String username, String password);
|
||||
|
||||
List<String> list(String client, String path);
|
||||
void upload(String client, String path, in byte[] bytes);
|
||||
byte[] download(String client, String path);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package nodomain.freeyourgadget.internethelper;
|
||||
|
||||
interface INetworkService {
|
||||
int version();
|
||||
}
|
|
@ -128,7 +128,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.PendingIntentUtils;
|
|||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.WidgetPreferenceStorage;
|
||||
import nodomain.freeyourgadget.internethelper.INetworkService;
|
||||
import nodomain.freeyourgadget.internethelper.IFtpService;
|
||||
|
||||
public class DebugActivity extends AbstractGBActivity {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DebugActivity.class);
|
||||
|
@ -909,7 +909,9 @@ public class DebugActivity extends AbstractGBActivity {
|
|||
.show();
|
||||
}
|
||||
|
||||
INetworkService iRemoteService;
|
||||
IFtpService iRemoteService;
|
||||
String client;
|
||||
int i = 0;
|
||||
|
||||
private void testNewFunctionality() {
|
||||
if (ActivityCompat.checkSelfPermission(getApplicationContext(), "nodomain.freeyourgadget.internethelper.INTERNET") != PackageManager.PERMISSION_GRANTED) {
|
||||
|
@ -928,7 +930,7 @@ public class DebugActivity extends AbstractGBActivity {
|
|||
|
||||
// Following the preceding example for an AIDL interface,
|
||||
// this gets an instance of the IRemoteInterface, which we can use to call on the service.
|
||||
iRemoteService = INetworkService.Stub.asInterface(service);
|
||||
iRemoteService = IFtpService.Stub.asInterface(service);
|
||||
}
|
||||
|
||||
// Called when the connection with the service disconnects unexpectedly.
|
||||
|
@ -945,13 +947,32 @@ public class DebugActivity extends AbstractGBActivity {
|
|||
} else {
|
||||
LOG.warn("Could not bind to NetworkService");
|
||||
}
|
||||
} else {
|
||||
} else if (i == 0) {
|
||||
try {
|
||||
final int version = iRemoteService.version();
|
||||
LOG.info("version = {}", version);
|
||||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
LOG.error("cenas {} failed", i ,e);
|
||||
}
|
||||
i++;
|
||||
} else if (i == 1) {
|
||||
try {
|
||||
client = iRemoteService.createClient();
|
||||
LOG.info("client = {}", client);
|
||||
} catch (RemoteException e) {
|
||||
LOG.error("cenas {} failed", i ,e);
|
||||
}
|
||||
i++;
|
||||
} else if (i == 2) {
|
||||
try {
|
||||
iRemoteService.connect(client, "10.0.1.12", 8710);
|
||||
LOG.info("connected");
|
||||
} catch (RemoteException e) {
|
||||
LOG.error("connected {} failed", i ,e);
|
||||
}
|
||||
i++;
|
||||
} else {
|
||||
LOG.info("wtf {}", i);
|
||||
}
|
||||
|
||||
//GBApplication.deviceService().onTestNewFunction();
|
||||
|
|
Loading…
Reference in New Issue
Block a user