I think the simplest way to perform a tightly sampled ProjectedLocalDensityOfStates and then extract the DOS along the device transport direction, and from there calculate the energy gap. I have uploaded a script that does this. Bear in mind that the PLDSO must be quite accurate (I used 501 energy points in the energy window where I expect the gap to be located). Also, a tolerance for "small energies" must be supplied, in order to determine if an energy should be considered inside or outside of the band gap.
Hope this is useful.