~./P_rfid.cpp:19: error: ‘P_rfid’ has not been declared

I am a complete novice on library creation and I get the errors below when trying to compile a sketch.

/home/andrew/arduino-0022/libraries/P_rfid/P_rfid.cpp:19: error: ‘P_rfid’ has not been declared
/home/andrew/arduino-0022/libraries/P_rfid/P_rfid.cpp:19: error: expected constructor, destructor, or type conversion before ‘(’ token

the attached files are the library files.
brlow is the test sketch

#include <AF_XPort.h>
#include <string.h>
#include <avr/io.h>
#include <NewSoftSerial.h>
#include <P_rfid.h>

#define rxPin 8
#define txPin 9
#define enabl 11
// RFID reader SOUT pin connected to Serial RX pin at 2400bps to pin8
P_rfid RFID = P_rfid(rxPin,txPin, enabl);
char code[11];

void setup()
{
Serial.begin(57600); // Hardware serial for Monitor 2400bps

RFID.begin(2400);
}

void loop()
{

int avail = 100;
if(RFID.available(avail)>0){
RFID.readcode(code);

}
}

keywords.txt (404 Bytes)

P_rfid.cpp (1.82 KB)

P_rfid.h (219 Bytes)

Typically, the source code needs to include the header file. Yours doesn't. Without it, the compiler has no idea that P_rfid is a class, or that P_rfid::P_rfid() is a constructor.

Why does the begin() method take an argument that is not used?

The available() method should return the number of bytes available, not true or false. The timeout function will not do what it appears that you think it will, unless you plan on calling it with a very, very large number.

What kind of type is unit_8? I've heard of uint_8 (unsigned int, 8 bits), but not unit_8 or unit_16.

Thanks PaulS

I did discover that I needed to include the header in my .cpp file and that resolved the error.

What kind of type is unit_8? I've heard of uint_8 (unsigned int, 8 bits), but not unit_8 or unit_16.

my typo - I have changed these to just straight int

Why does the begin() method take an argument that is not used?

I was basing it on the root function in NewSoftSerial but could just as easily scrap that

The available() method should return the number of bytes available, not true or false. The timeout function will not do what it appears that you think it will, unless you plan on calling it with a very, very large number.

Once again based on a code snippet - I will clean this up a bit , I do have the library working now and will try to clean things up based on your observations.