Weitere ähnliche Inhalte Ähnlich wie Android things Dev fest seoul 2017 (20) Android things Dev fest seoul 20175. 카메라
게이트웨이
냉난방
스마트 미터
판매 정보 관리
재고 관리
인터액티브 광고
자판기
보안 시스템
스마트 잠금
공유기
에너지 감시 장치
자산 추적관리
차량 관리
운전자 어시스턴트
예측 서비스
보안, 스마트, 컴퓨팅 IoT 디바이스
20. dependencies {
provided 'com.google.android.things:androidthings:...'
}
<application ...>
<uses-library android:name="com.google.android.things"/>
<activity ...>
...
<!-- Launch activity automatically on boot -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.IOT_LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
예
22. // Open a peripheral connection
PeripheralManagerService service = new PeripheralManagerService();
Gpio button = service.openGpio(GPIO_PIN_NAME);
// Configure the peripheral
button.setDirection(Gpio.DIRECTION_IN);
button.setEdgeTriggerType(Gpio.EDGE_FALLING);
// Attach callback for input events
button.registerGpioCallback(new GpioCallback() {
@Override
public boolean onGpioEdge(Gpio gpio) {
Log.i(TAG, "GPIO changed");
// Return true to continue listening to events
return true;
}
});
예 입출력
24. private GpioCallback callback = new GpioCallback() {
@Override
public boolean onGpioEdge(Gpio gpio) {
int keyAction = gpio.getValue() ?
KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP;
inputDriver.emit(new KeyEvent[]{
new KeyEvent(keyAction, KeyEvent.KEYCODE_SPACE)});
return true;
}
};
예 버튼
InputDriver driver = new InputDriver.Builder(InputDevice.SOURCE_CLASS_BUTTON)
.setName(DRIVER_NAME)
.setVersion(DRIVER_VERSION)
.setKeys(new int[]{KeyEvent.KEYCODE_SPACE})
.build();
UserDriverManager.getManager().registerInputDriver(driver);
28. Google의 IoT 개발자 커뮤니티
https://g.co/iotdev
Android Things SDK
https://developer.android.com/things
Hackster.io 커뮤니티
https://hackster.io/google
장인선
insunj@google.com