In this paper, we present a hierarchical, distributed, cloud-based, context-aware architecture for collecting, processing and distributing data in a smart city. The architecture we are proposing has three hierarchical levels, and supports complex event processing (CEP) in several of them. At the lower layer, several mobile objects work as interfaces to sensors and actuators and provide processing capability for local filtering and detection. A second level, consisting of gateways and processing nodes, processes information from its locale and sends the data received from the mobile objects to the storage level using the existing network infrastructure. The highest level provides support for structured storage and queries of the information. Applications outside the platform can collect data through the external interface of the highest level. The system is under development using the InterSCity platform in the upper layer, the ContextNet middleware at the middle layer, and the Mobile-Hub application at the lower layer. It currently collects and processes data on buses running in the City of Rio de Janeiro.