Generating barcodes is fairly simple, you just need to draw some lines of varying thickness in patterns as defined for the barcode type.
This entry[
^] in Wikipedia shows how to build the Code39 type.
Scanning barcodes is somewhat more complicated as you need to get the specification of the hardware device and only the manufacturers will be able to provide that for you.