Skip to content

Commit

Permalink
Check available GPIO ports on activity created
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Jordan committed May 2, 2017
1 parent f8426cd commit c89dff2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 62 deletions.
17 changes: 1 addition & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'com.android.application'

Expand All @@ -21,7 +6,7 @@ android {
buildToolsVersion '25.0.2'

defaultConfig {
applicationId "com.example.androidthings.myproject"
applicationId "com.example.androidthings.firstdevice"
minSdkVersion 24
targetSdkVersion 25
versionCode 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
/*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.example.androidthings.firstdevice;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

import com.google.android.things.pio.PeripheralManagerService;

/**
* Skeleton of the main Android Things activity. Implement your device's logic
* in this class.
Expand All @@ -46,6 +32,14 @@ public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d(TAG, "onCreate");

PeripheralManagerService service = new PeripheralManagerService();
if (service != null) {
Log.d(TAG, "Available GPIO: " + service.getGpioList());
}
else {
Log.d(TAG, "Unable to create PeripheralManagerService.");
}
}

@Override
Expand Down
15 changes: 0 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

buildscript {
repositories {
Expand Down
15 changes: 0 additions & 15 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
/*
* Copyright 2016, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

include ':app'

0 comments on commit c89dff2

Please sign in to comment.