summaryrefslogtreecommitdiff
path: root/chromium/device/usb/usb_endpoint_android.cc
blob: a5eff76c60ec0b2510f10a7bb4fd4c10a63dab14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "device/usb/usb_endpoint_android.h"

#include "jni/ChromeUsbEndpoint_jni.h"

namespace device {

// static
UsbEndpointDescriptor UsbEndpointAndroid::Convert(
    JNIEnv* env,
    const base::android::JavaRef<jobject>& usb_endpoint) {
  base::android::ScopedJavaLocalRef<jobject> wrapper =
      Java_ChromeUsbEndpoint_create(env, usb_endpoint);

  UsbEndpointDescriptor endpoint(
      Java_ChromeUsbEndpoint_getAddress(env, wrapper),
      Java_ChromeUsbEndpoint_getAttributes(env, wrapper),
      Java_ChromeUsbEndpoint_getMaxPacketSize(env, wrapper),
      Java_ChromeUsbEndpoint_getInterval(env, wrapper));

  return endpoint;
}

}  // namespace device