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