Anti Aircraft role seems likely, the allies used the stokes mortar for AA fire it was more of a deterent then anything else....
"During our two months of trench warfare following the battle of Messines we experimented with the Stokes for anti-aircraft defence, and found it most successful. In this branch we(at that time I was in the 4th Light Trench Mortar Battalion)were the first battery to try this exciting means of stopping Hun aircraft from flying over our trenches.
I remember the first day we tried the Stokes out in its new capacity, how excited we all were at the possibility of bringing down an enemy 'plane. We set up three guns at intervals of about 150 yards along the front: one gun with fuses cut to burst at three seconds, another at four seconds, and another at five seconds; and patiently awaited developments. It was not long before our patience was rewarded, and a big enemy plane crossed our line at a height of about 500 feet. The nearest gun opened on him with two fine bursts just above him, while simultaneously the second gun put two equally good bursts underneath. The Infantry were very interested and excited at the thought of the possibility of bringing down a 'plane, and the machine seemed to falter and fall and then right itself and made off back to the enemy lines. Other enemy planes came over that day to investigate this new method of ours in anti-aircraft defence, but were very wary, and kept at a height where our mortars could not reach them.
In effect, the result obtained was this: that our lines were very seldom crossed by low-flying enemy 'planes in this sector."
From "With the Trench Mortars in France" page 48-49
I would suggest that he is checking he has enough elevation to clear the obstacles in front. The sight is parallel to the barrel. I have never seen it before either but it explains the bracket on the barrel which is common.