I hereby claim:
- I am rosshambrick on github.
- I am rosshambrick (https://keybase.io/rosshambrick) on keybase.
- I have a public key ASD0KpAelw1O2RRQuJDmTuyVi-xtVBSPjzkPeXmvTZ-6wQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
require 'pivotal-tracker' | |
puts 'Setting stories to Delivered in Pivotal Tracker' | |
# Import env vars | |
pt_token = ENV['PIVOTAL_TRACKER_TOKEN'] | |
if pt_token.nil? || pt_token.empty? | |
puts 'Pivotal Tracker token is required to update statuses' | |
exit 0 |
@OnClick({R.id.btn_send}) | |
public void sendClicked() { | |
if(arduinoDevice != null){ | |
byte[] bytesOut = et_output.getText().toString().getBytes(); //convert String to byte[] | |
usbArduinoConnection.bulkTransfer( endpointOut, bytesOut, bytesOut.length, 0); | |
} | |
} |
permissionIntent = PendingIntent.getBroadcast(getActivity(), 0, new Intent(ACTION_USB_PERMISSION), 0); | |
getActivity().registerReceiver(usbReceiver, new IntentFilter(ACTION_USB_PERMISSION)); | |
getActivity().registerReceiver(usbDeviceReceiver, new IntentFilter(UsbManager.ACTION_USB_DEVICE_ATTACHED)); | |
getActivity().registerReceiver(usbDeviceReceiver, new IntentFilter(UsbManager.ACTION_USB_DEVICE_DETACHED)); |
private void setupUsbComm() { | |
final int RQSID_SET_LINE_CODING = 0x20; | |
final int RQSID_SET_CONTROL_LINE_STATE = 0x22; | |
UsbManager manager = (UsbManager) getActivity().getSystemService(Context.USB_SERVICE); | |
Boolean permitToRead = manager.hasPermission(arduinoDevice); | |
if (permitToRead) { | |
usbArduinoConnection = manager.openDevice(arduinoDevice); |
private void searchEndPoint() { | |
usbInterfaceFound = null; | |
endpointOut = null; | |
endpointIn = null; | |
if (arduinoDevice == null) { | |
UsbManager manager = (UsbManager) getActivity().getSystemService(Context.USB_SERVICE); | |
HashMap<String, UsbDevice> deviceList = manager.getDeviceList(); | |
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator(); |
private final BroadcastReceiver usbDeviceReceiver = new BroadcastReceiver() { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
String action = intent.getAction(); | |
if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) { | |
arduinoDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); | |
tv_status.setText("ACTION_USB_DEVICE_ATTACHED: \n" + arduinoDevice.toString()); | |
connectUsb(); | |
} else if (UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)) { |
static final int targetVendorID = 9025; //Arduino Uno | |
static final int targetProductID = 67; //Arduino Uno, do not use 0067 | |
static final String ACTION_USB_PERMISSION = "USB_PERMISSION"; | |
UsbInterface usbInterface; | |
UsbDeviceConnection usbArduinoConnection; | |
UsbDevice arduinoDevice; | |
UsbInterface usbInterfaceFound; | |
UsbEndpoint endpointIn; | |
UsbEndpoint endpointOut; |
<!-- For Arduino. --> | |
<uses-feature android:name="android.hardware.usb.host" /> | |
<application | |
android:name=".HackathonApplication" | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:theme="@style/Theme.AppCompat" > | |
<activity |
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- vendor-id=2341, product-id=0043 for Arduino Uno--> | |
<usb-device | |
vendor-id="9025" | |
product-id="0067" /> | |
</resources> |