issue #2304:use function to simplify acceremeter call back