blob: 0cf3113c19301ef2bc0efe981c5cbd4069c4eb53 [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 android.widget.TextView;
import java.io.IOException;
import android.os.Handler;
import android.util.Log;
public class MainActivity extends Activity {
TextView textView;
private static final String TAG = "araepm";
private DME dme = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView)findViewById(R.id.textView);
}
@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 getReq(View view) {
int rc;
Log.d(TAG, "button pressed");
try {
rc = dme.readDMEConfig(0, false, DME.AttributeId.DME_LINKSTARTUP, 0, 0);
} catch (IOException e) {
return;
}
Log.d(TAG, "DME rc: " + rc);
}
}