A simulation-based study of wireless sensor network middleware