Home | History | Annotate | Download | only in default
      1 
      2 #define LOG_TAG "hidl_test"
      3 
      4 #include "Bar.h"
      5 
      6 #include <inttypes.h>
      7 
      8 #include <log/log.h>
      9 
     10 namespace android {
     11 namespace hardware {
     12 namespace tests {
     13 namespace bar {
     14 namespace V1_0 {
     15 namespace implementation {
     16 
     17 Bar::Bar() {
     18     mFoo = IFoo::getService("", true);
     19 }
     20 
     21 // Methods from ::android::hardware::tests::foo::V1_0::IFoo follow.
     22 Return<void> Bar::doThis(float param) {
     23     return mFoo->doThis(param);
     24 }
     25 
     26 Return<int32_t> Bar::doThatAndReturnSomething(
     27         int64_t param) {
     28     return mFoo->doThatAndReturnSomething(param);
     29 }
     30 
     31 Return<double> Bar::doQuiteABit(
     32         int32_t a,
     33         int64_t b,
     34         float c,
     35         double d) {
     36     return mFoo->doQuiteABit(a, b, c, d);
     37 }
     38 
     39 Return<void> Bar::doSomethingElse(
     40         const hidl_array<int32_t, 15> &param, doSomethingElse_cb _cb) {
     41     return mFoo->doSomethingElse(param, _cb);
     42 }
     43 
     44 Return<void> Bar::doStuffAndReturnAString(
     45         doStuffAndReturnAString_cb _cb) {
     46     return mFoo->doStuffAndReturnAString(_cb);
     47 }
     48 
     49 Return<void> Bar::mapThisVector(
     50         const hidl_vec<int32_t> &param, mapThisVector_cb _cb) {
     51     return mFoo->mapThisVector(param, _cb);
     52 }
     53 
     54 Return<void> Bar::callMe(
     55         const sp<IFooCallback> &cb) {
     56     return mFoo->callMe(cb);
     57 }
     58 
     59 Return<Bar::SomeEnum> Bar::useAnEnum(SomeEnum param) {
     60     return mFoo->useAnEnum(param);
     61 }
     62 
     63 Return<void> Bar::haveAGooberVec(const hidl_vec<Goober>& param) {
     64     return mFoo->haveAGooberVec(param);
     65 }
     66 
     67 Return<void> Bar::haveAGoober(const Goober &g) {
     68     return mFoo->haveAGoober(g);
     69 }
     70 
     71 Return<void> Bar::haveAGooberArray(const hidl_array<Goober, 20> &lots) {
     72     return mFoo->haveAGooberArray(lots);
     73 }
     74 
     75 Return<void> Bar::haveATypeFromAnotherFile(const Abc &def) {
     76     return mFoo->haveATypeFromAnotherFile(def);
     77 }
     78 
     79 Return<void> Bar::haveSomeStrings(
     80         const hidl_array<hidl_string, 3> &array,
     81         haveSomeStrings_cb _cb) {
     82     return mFoo->haveSomeStrings(array, _cb);
     83 }
     84 
     85 Return<void> Bar::haveAStringVec(
     86         const hidl_vec<hidl_string> &vector,
     87         haveAStringVec_cb _cb) {
     88     return mFoo->haveAStringVec(vector, _cb);
     89 }
     90 
     91 Return<void> Bar::transposeMe(
     92         const hidl_array<float, 3, 5> &in, transposeMe_cb _cb) {
     93     return mFoo->transposeMe(in, _cb);
     94 }
     95 
     96 Return<void> Bar::callingDrWho(
     97         const MultiDimensional &in, callingDrWho_cb _hidl_cb) {
     98     return mFoo->callingDrWho(in, _hidl_cb);
     99 }
    100 
    101 Return<void> Bar::transpose(const StringMatrix5x3 &in, transpose_cb _hidl_cb) {
    102     return mFoo->transpose(in, _hidl_cb);
    103 }
    104 
    105 Return<void> Bar::transpose2(
    106         const hidl_array<hidl_string, 5, 3> &in, transpose2_cb _hidl_cb) {
    107     return mFoo->transpose2(in, _hidl_cb);
    108 }
    109 
    110 Return<void> Bar::sendVec(
    111         const hidl_vec<uint8_t> &data, sendVec_cb _hidl_cb) {
    112     return mFoo->sendVec(data, _hidl_cb);
    113 }
    114 
    115 Return<void> Bar::sendVecVec(sendVecVec_cb _hidl_cb) {
    116     return mFoo->sendVecVec(_hidl_cb);
    117 }
    118 
    119 Return<void> Bar::haveAVectorOfInterfaces(
    120         const hidl_vec<sp<ISimple> > &in,
    121         haveAVectorOfInterfaces_cb _hidl_cb) {
    122     _hidl_cb(in);
    123 
    124     return Void();
    125 }
    126 
    127 Return<void> Bar::haveAVectorOfGenericInterfaces(
    128         const hidl_vec<sp<android::hidl::base::V1_0::IBase> > &in,
    129         haveAVectorOfGenericInterfaces_cb _hidl_cb) {
    130     _hidl_cb(in);
    131 
    132     return Void();
    133 }
    134 
    135 Return<void> Bar::createMyHandle(createMyHandle_cb _hidl_cb) {
    136     return mFoo->createMyHandle(_hidl_cb);
    137 }
    138 
    139 Return<void> Bar::createHandles(uint32_t size, createHandles_cb _hidl_cb) {
    140     return mFoo->createHandles(size, _hidl_cb);
    141 }
    142 
    143 Return<void> Bar::closeHandles() {
    144     return mFoo->closeHandles();
    145 }
    146 
    147 Return<void> Bar::echoNullInterface(const sp<IFooCallback> &cb, echoNullInterface_cb _hidl_cb) {
    148     return mFoo->echoNullInterface(cb, _hidl_cb);
    149 }
    150 
    151 // Methods from ::android::hardware::tests::bar::V1_0::IBar follow.
    152 Return<void> Bar::thisIsNew()  {
    153     ALOGI("SERVER(Bar) thisIsNew");
    154 
    155     return Void();
    156 }
    157 
    158 Return<void> Bar::expectNullHandle(const hidl_handle& h, const Abc& xyz, expectNullHandle_cb _hidl_cb) {
    159     ALOGI("SERVER(Bar) h = %p, xyz.z = %p", h.getNativeHandle(), xyz.z.getNativeHandle());
    160     _hidl_cb(h == nullptr, xyz.z == nullptr);
    161     return Void();
    162 }
    163 
    164 Return<void> Bar::takeAMask(BitField bf, uint8_t first, const MyMask& second, uint8_t third,
    165             takeAMask_cb _hidl_cb) {
    166     _hidl_cb(bf, bf | first, second.value & bf, (bf | bf) & third);
    167     return Void();
    168 }
    169 
    170 Return<sp<ISimple>> Bar::haveAInterface(const sp<ISimple> &in) {
    171     return in;
    172 }
    173 
    174 
    175 IBar* HIDL_FETCH_IBar(const char* /* name */) {
    176     return new Bar();
    177 }
    178 
    179 } // namespace implementation
    180 }  // namespace V1_0
    181 }  // namespace bar
    182 }  // namespace tests
    183 }  // namespace hardware
    184 }  // namespace android
    185