B4R Question creation of library, need help

candide

Active Member
Licensed User
i would like to use a library arduino on B4R, and i have som issues

original library is :
B4X:
/*
  RFControl.h -
*/
#ifndef ArduinoRf_h
#define ArduinoRf_h

class RFControl
{
  public:
    static unsigned int getPulseLengthDivider();
    static void startReceiving(int interruptPin);
    static void stopReceiving();
    static bool hasData();
    static void getRaw(unsigned int **timings, unsigned int* timings_size);
    static void continueReceiving();
    static bool compressTimings(unsigned int buckets[8], unsigned int *timings, unsigned int timings_size);
    static bool compressTimingsAndSortBuckets(unsigned int buckets[8], unsigned int *timings, unsigned int timings_size);
    static void sendByTimings(int transmitterPin, unsigned int *timings, unsigned int timings_size, unsigned int repeats = 3);
    static void sendByCompressedTimings(int transmitterPin, unsigned long* buckets, char* compressTimings, unsigned int repeats = 3);
    static unsigned int getLastDuration();
    static bool existNewDuration();
  private:
    RFControl();
};
#endif

first, i have issue with this line : static void getRaw(unsigned int **timings, unsigned int* timings_size);
what to do with **timings?

after, at xml creation, we have to define property / method
normally property should be a simple method with return and without parameter (like a get) or with a parameter but without return (like set) but from B4Rh2xml.jar run, it is not working in this way... What is the good way ?

and what is impact of static parameter in h file ? can we ignore it for wrapper?

and when we have uint getPulseLengthDivider(); in wrapper h file, in xml i have <name>PulseLengthDivider</name>
"get" is removed, is it normal and why ?

original library and first work on a wrapper are in zip attached, but i am stuck with unsigned int **timings : i didn't see similar examples of wrapper...

thanks for your help
 

Attachments

  • RFControl-master.zip
    5.7 KB · Views: 215
Last edited:

miker2069

Active Member
Licensed User
Longtime User
Perhaps you could try it as inline c first? Honestly every time I sit down to try and write a library, I end up just using a module with inline C and it does what I need it to do. Far easier to work out the kinks there and if you want to then polish it off in a library it should be a bit more straight forward.
 
Upvote 0
Top