blob: 5067760f9951d8cede518d4884991654d5c8c65d [file] [log] [blame]
package com.projectara.araepm;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.hardware.I2cManager;
import android.hardware.I2cTransaction;
import java.io.IOException;
import android.os.Handler;
import android.util.Log;
public class MainActivity extends Activity {
private static final String TAG = "araepm";
private DME dme = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
protected void onStart(){
Log.d(TAG, "onstart");
super.onStart();
I2cManager i2c = (I2cManager) getSystemService(I2C_SERVICE);
dme = new DME(i2c);
}
@Override
protected void onStop() {
Log.d(TAG, "onstop");
super.onStop();
}
public void attachEpm(View view) {
int rc;
Log.d(TAG, "EPM attach button pressed");
try {
dme.writeDMEConfig(0,
true,
DME.AttributeId.DME_MAILBOX,
0,
1,
0);
} catch (IOException e) {
return;
}
}
public void detachEpm(View view) {
int rc;
Log.d(TAG, "EPM detach button pressed");
try {
dme.writeDMEConfig(0, true,
DME.AttributeId.DME_MAILBOX,
0,
2,
0);
} catch (IOException e) {
return;
}
}
}