coverageBed from BEDTools will report the depth / breadth of coverage of a BAM file on a set of features in BED, GFF, or VCF format. Thus, it should work fine for your purposes, unless you are doing some very specialized calculation. If you just need counts per exon, you might want to use intersectBed with the groupBy tool, as coverageBed spends extra time computing the "shape" of coverage.
I am also trying to do the same thing, and I wrote a code in Bash script, its working well with a small file, but when I am trying it to run in a whole exome file and the sequence file with the read per base information, its not giving me any result.
The scripts just keeps on running,because it is not able to load this big file in an array.
So in what language are you planning to write your tool?