Towards Connectionless Communication for Local Message Dissemination

We Bluetooth to collect the data from several smartphones and use simulator for large-scale experiments


I. INTRODUCTION
Smartphones have become one of the most revolutionary devices in the history of computing.With its prevalence, today's smartphones have gone far beyond a mobile telephone as they have seamlessly dissolved in every aspect of our daily life.Together with the fast-development of cloud computing [1]- [3] and edge computing [4]- [6], a variety of applications has been developed to meet all kinds of demands.For instance, Facebook [7] and Twitter [8] are popular in social networks; Google Maps [9] and Waze [10] are used for navigations; Siri [11] and Cortana [12] provide virtual assistants.Furthermore, the deployment of deep learning applications on the cloud [3], [13]- [15] has employed applications with more intelligence.These applications significantly improve the quality of our life, regarding connectivity, productivity, and efficiency.Most of the applications are built on the fundamental of a communication system, the network infrastructures, which include many components, such as cellular towers, cables, servers, switches, and routers, etc.This system along with the clientserver architecture have been proved to provide stable services to hundreds of thousands of users every second.However, this conventional client-server model limits the application scope and may hinder wide deployment of location related mobile Ying Mao is with the Department of Computer and Information Science, Fordham University, New York, NY, 10458 Email: maoy@tcnj.eduapplications because of the following disadvantages.First, there is no general channel for users to browse all available service resources nearby without registering for each and every one of them on the servers.Furthermore, it requires Internet connection even when a sender and receiver are adjacently located, which will unnecessarily increase the Internet traffic burden and users' bandwidth cost.With this requirement, in addition, applications are not robust against catastrophic infrastructure failures.
Motivated by the facts that people carriers a smartphone most of the time [16], this paper develops a local data dissemination system that is based on a smartphone adhoc communication model.The smartphone ad-hoc network aims to provide a robust and infrastructure-free alternative to the cellular network.In practice, however, creating and maintaining a direct link between two nearby devices, which is the building block of an ad-hoc network, is costly.For example, both Bluetooth and WiFi-Direct require a slow initial phase of discovering nearby peers and handshaking to establish a connection that introduce user operations.It is especially inefficient for transferring a small amount of data locally.In addition, connected link may bring with it a security risk because one device might be able to access all exposed services on the connected device (e.g., in Bluetooth).Pairing Bluetooth devices also brings with it a security risk because because a paired device can access all exposed services on a device.In this project, we build a local data dissemination system upon a new communication model, called passive broadcast [17].It is a connectionless and receiver-initialized model where each node periodically scans other nodes in the communication range and obtains their data if available (see Fig. 1, i.e., each scan is a many-to-one communication.The representative carriers of passive broadcast in reality include Bluetooth and WiFi-Direct, both of which define a mandatory 'peer discovery' function to fetch basic information about nearby devices.This function can be easily extended to implement passive broadcast mechanism without modifying the existing network protocol stack.We particularly use the field of 'device name' to carry payload data.When a user intents to send a message, he assigns the message to his phone's Bluetooth or WiFi-Derect device name.When other phones conduct the peer discovery, the message will be sent over.
Compared to traditional Mobile Ad-hoc Networks, in passive broadcast model, the cost for establishing and maintaining direct links is negligible and our experiments show that the communication range is expanded compare to the established connection over the same radio interface.How-ever, this receiver-initialized communication inevitably causes a delay on the sender side after data is ready and before data is sent.Thus, network throughput of passive delivery is limited.In this project, we use passive delivery to build local data dissemination systems for gossip-style communication.Our target applications include spreading tweets, facebook messages or Google Hangout messages to nearby nodes and local instant messenger.

II. RELATED WORK
Ad-hoc networks have been proposed as a complementary alternative to the traditional infrastructure-based communication technology.
In the literature, several mobile ad-hoc networks(MANETs) based communication system have been proposed for various scenarios.In mobile social networks, authors in [18]- [21] aim at data dissemination in resource-constrained opportunistic networks, broadcasting from superusers and ferrying messages in intermittently connected mobile networks.Point&Connect [22] implements pointing gestures of moving one device towards another in order to enable spontaneous device pairing.Musubi [23] provides a decentralized trusted social services on personal mobile devices.While Bub-bleRap [24] utilizes centralized membership information to improve standard unicast routing.WiFi-Opp [25] is developed to support opportunistic communications by exploiting the mobile AP mode.However, AP mode is unsupported on lowend smartphones.
For delay tolerant networks, the authors in [26] propose a gossiping-based approach, where each node forwards a message with some probability, to reduce the overhead of the routing protocols.The protocol uses notably fewer messages than flooding and provides well enough performance.As people are moving or on the vehicle, unlike traditional network, mobile social network is not always connected.Authors in [27] proposes to use data diffusion to reduce the query delay in DTNs.They use theoretical models to analyze the data diffusion process and compare the performance of the their proposed diffusion schemes in terms of diffusion speed and query delay.
In the field of opportunistic networks, through adopting the concept of opportunistic beacons, the idea of Opportunistic Beacon Networking (OBN) is presented in [28].It is a highlyopportunistic but a limited-throughput approach.Its enhanced version, BLESSED [29], utilizes the a dual-radio setting of both WiFi Hotspot and Bluetooth low energy(BLE).
Due to the infrastructure-free feature, the ad hoc network is also widely used in disaster rescue.7DS [30] is developed to address network disruption problem in mobile networks by providing store-carry-forward communication.Wu et al. [31] present a routing protocol to disseminate emergency messages among any smartphones when cellular infrastructure is unavailable.However, it only focuses on prioritization of messages for one-way unicast communications.Distress-Net [32] allows users to quickly and reliably store and retrieve data in a cloud-like manner.Emergency response personnel can use portable devices such as tablets or smartphones to monitor field data and collaborate with other teams.However, DistressNet requires deploying large amount of sensors over the disaster area which is not available for most of the scenarios.DISANET [33] is used to exchange text, voice and video messages between rescue workers and the command center.TeamPhone [34] integrates cellular networking, adhoc networking and opportunistic networking seamlessly, and enables communications among rescue workers.However, on principal, it is based on Greedy Perimeter Stateless Routing (GPSR).
Although our paper is based on MANETs, the focus of the problem is a different communication model and our objective is different from the previous works.Passive broadcast is a receiver-initialized connectionless communication based on many-to-one delivery in each scan.In addition, we target on a distributed and collaborative solution that efficiently disseminate messages between rescuers nearby victims.Furthermore, the proposed system requires limited operations from the users.One project closely related to our passive broadcast model is called Dythr [35] which lets a phone broadcast a WiFi hotspot with the SSID being the message.This method actually is from the opposite direction of 'active' delivery as every node frequently injects messages into the wireless channel.In [36], Huang et al. proposed PhoneNet [37].This method uses a central server to establish links between devices connected to a WiFi network and then allows devices connected on local networks to connect directly.In [38], the authors use Bluetooth service discovery protocol to find common interests between two users.Similar to our proposed work, no connection is established and each user stores the keyword about his interest in Bluetooth service ID.However, this work is for twouser communication while our problem is set in a multiple user environment and our goal is to determine each device's schedules to achieve the efficiency.

III. SYSTEM MODEL
The main research target of this project is to develop a local message dissemination system based on passive broadcast with the objective of achieving efficiency in terms of time overhead and power consumption.In another word, how to quickly disseminate messages in a smartphone ad-hoc network with as little power consumption as possible.

A. Communication Model
Our solution is based on the new passive broadcast (PASA) communication model, where each sender buffers its broadcast data locally and the receiver initializes the transmission and fetches all available data from nearby nodes.In the system, PASA serves as a middleware between applications(e.g.Facebook, Twitter) and network interfaces.When having a message to deliver, the application sends to PASA middleware.Accoding to user's specifications, PASA decides which network interfaces to use.If the users would like to share the message online, WiFi or celluar network interface will be chosen.Otherwise, if the users would like to share the message with nearby strangers, the ad-hoc networks will be used and Bluetooth or WiFi-Direct interface will be chosen.In the later settings, the message stores in local buffer, and the application does not control when the message will be sent to another nearby node.Meanwhile, each node periodically scans other nodes in the communication range and obtains the data in their buffers if available, i.e., each scan is a many-to-one communication.• Constraint collector: It collects the specified constraints include how urgent a user need to spread this messages or collecting nearby messages, limitations of power consumption, and a particular performance objective.We have implemented this model based on the mandatary 'peer discovery' function in both Bluetooth and WiFi-Direct.In the rest of this paper, we take Bluetooth as a platform instance to introduce our solution.Basically, we use the field of 'device name' to carry target payload data.When a user intents to send a message, he assigns the message to his phone's Bluetooth device name.When other phones conduct peer discovery, the message will be sent over.The length of device names is usually limited, e.g., a Bluetooth's device name in Android can be up to 248 bytes.A large message can be fragmented to fit in and a phone can periodically change the device name to rotate multiple messages or fragments.

B. Smartphone Operations and States
In our problem setting, we assume that there are n smartphone nodes ({p 1 , p 2 , . . ., p n }) and we consider a fullyconnected network model where all the phones are within each other's Bluetooth communication range.There are two basic operations for each smartphone p i , scan and update message.The first operation is the regular peer discovery process that collects messages from other phones, and the second one is to change its own device name to a new message.Update message operation can be finished instantly.But scan process has a long overhead.For Bluetooth, according to the standard and our experiments, a scan operation usually takes 10 ∼ 12 seconds to finish.Therefore, we further define two states for each phone: when a phone is conducting scan (peer discovery), it is in scanning phase; otherwise, it is in idle phase.For each message, we define its active period as the duration when the message is available for scanning, i.e., after the message is put on the device name and before it is replaced by the next message.If a phone finishes a complete scan during a message's active period, the message will be surely scanned by the phone.If the active period starts or ends during a scanning process, the phone has a certain probability to receive the message.We will present detailed analysis later in Section V. Specifically, we use T i to represent p i 's scan interval which is defined as the interval between the end of the prior scan and the beginning of the next scan, i.e., the length of p i 's idle phase.Additionally, we use U i to indicate the message update interval of p i , i.e., p i changes its device name once every U i time units.Different from T i , U i 's value can be dynamically changed as it does not incur any extra computation overhead or power consumption.Furthermore, we define S as the length of scanning phase, which is a constant for all phones.
In our solution, each phone and each active message has a unique identifier defined as follows: • Phone ID: In this paper, we use the MAC address as each phone's identity.When scanning nearby devices, a phone automatically obtains their MAC addresses and is able to recognize these phones later.• Message ID: Each message can be identified by its owner's MAC address and a local index number.For example, aa:bb:cc:dd:ee:ff.12 represents a message from the phone with a MAC address of aa:bb:cc:dd:ee:ff and its index number on that phone is 12.In our solution, each index number is incremental with new messages and set up to 255 after which it will be reset to 0.

C. Message Format
In our solution, the device name is divided into two segments, header and payload.Similar to other network protocol, 'header' field contains control and management data and 'payload' stores the messages being broadcast.The header includes the following fields: • Scan interval T : Each phone p i uses one byte to represent its own scan interval T i in the unit of second.• Index range of active messages: Each phone uses two bytes to specify the index number range of its active messages.We assume each user defines his own policy for disseminate the most recent messages, e.g., the most recent 10 messages, or the messages generated in the past 5 hours.• Message reception feedback: Each phone includes a message reception feedback to indicate the current state of the reception.Our solution uses a hash table to represent this feedback information.The keys are the neighboring devices' phone IDs and the associated elements are a structure of bitmaps.Namely, every message from a neighbor node is flagged by one bit in the feedback, '1' indicates 'received' and '0' means 'absent'.An example is shown in Fig. 3.
The following Table I lists some notations we use in the rest of the paper.

IV. MESSAGE DISSEMINATION WITH PASSIVE BROADCAST
In this section, we present our solution PASA that disseminates local messages based on passive broadcast model.We further provide numerical analysis to derive the optimal parameters for our solution.

A. Problem Formulation
Recall that we consider all the phones {p 1 , p 2 , . . ., p n } are within each other's communication range.Each phone p i holds k i messages to propagate to other phones.Assume each smartphone is aware of other phones' scan intervals after an initial scan.Without loss of generality, we sort all smartphones in the ascending order of their scan intervals, i.e., ∀i, j ∈ [1, n], if i < j, then T i ≤ T j .Let t i represent the time phone p i spends in receiving all the messages.Our objective in this paper is to minimize total complete time ∑ i t i .In this problem setting, both scan interval T i and update interval U i are important parameters for the objective.T i , however, is also the critical parameter for energy consumption which is another important performance metric for mobile devices.Therefore, in this paper, we assume that the scan schedule (decided by T i ) has been pre-configured by each phone based on its own performance concerns, e.g., power consumption and urgency of getting new messages.The essential goal of our algorithm is to determine the update interval (U i ) for each phone so that all phones can collaborate to disseminate all messages quickly.Our solution is based on an important property defined in the following Theorem 1.

Theorem 1. If a phone set its update interval to be T n + 2 • S, its message can surely be scanned by all other phones.
Proof: For any phone p i (T i ≤ T n ), apparently there must be a complete scan during a period of T n + 2 • S. Thus, the message will certainly be scanned by every phone.

B. Design of PASA
We present a solution with two stages for each participating phones.In the first stage, every phone simply sets U i to be a constant α and rotates its own k i messages.In the second stage, each phone set U i = T n + 2 • S and iteratively update the device name by one of the messages generated by its own or received from the first stage.In the first stage, the message update strategy is determined, but we need to derive the value for the update interval α.In the second stage, the update interval is fixed, and we shall design an algorithm to select the next message.In the rest of this section, we first present our algorithms for the second stage and then analyze the optimal value of α in the first stage.
In the second stage, the strategy of updating messages varies depending on each phone's status.We classify all phones into two categories and each category executes a different algorithm.The first category is called complete phones which includes all the smartphones that have received all ∑ i∈ [1,n] k i messages.The other category, incomplete phones, is the complement of the first category and includes the phones that have not received all messages.In the rest of this subsection, we develop two algorithms, one for incomplete phones and the other for complete phones.
Our basic intuition is to let all the smartphones assign the most wanted messages to the device names so that they can help other phones to speed up their message collection.In addition, we intent to avoid duplicate messages in the second stage.It is apparently inefficient if multiple phones put the same message on their devices' names.In the stretch of our solution, we give incomplete phones higher priority to select messages as the messages that incomplete phones can contribute in the second stage are limited.Complete phones, on the other hand, will estimate incomplete phones' choices and select other desired messages to serve in the second stage.
We use M to represent the set of all message IDs in a given network, i.e., in our setting, M includes ∑ i k i items.Assume all message IDs in M are sorted according to a predefined numerical conversion and let m i represent the i-th item in M .Each phone is aware of M after the initial scan.In addition, each phone maintains a two dimensional matrix M R to indicate the message reception status in the network, where M R ij = 1 if phone p i has received message m i (otherwise M R ij = 0).For each phone, this matrix M R is built upon the feedbacks from other phones.With the assistance of M R, each phone can derive sufficient information for updating messages in the second stage.First, each phone can identify all the complete phones and incomplete phones, i.e., p i is a complete phone if Let IP and CP respectively represent the set of incomplete phones and complete phones each phone is aware of.Second, each phone knows which messages it has received are needed by other phones.We let each phone p i build a set of candidate messages, indicated by C i , including all the messages that are useful for some other phones and could be put on the device name in the next round.By definition, each message In addition, we assume each phone has a different priority value based on the phone ID.Our algorithm will use this priority value to avoid unnecessary duplicate message selections from multiple phones.If a message is chosen by multiple phones, only the one with the highest priority will put it on the device name and the others have to yield and select other messages.Specifically, we assume a pre-defined the function f could convert a phone ID to a numerical value for comparison, i.e., p i has a higher priority than Message update for incomplete phones: In our solution, an incomplete phone applies the following Algorithm 1 in the second stage.Sort all candidate messages in C u in the ascending order of the number of phones having received the messages, i.e., for each message m v , the value of Let p a be the u-th phone in IP , choose the first message of C a : C a [1] 8: Remove C a [1] from the v-th phone in IP 10: In Algorithm 1, each incomplete phone first identifies all incomplete phones (the set IP ) and sorts them based on their priority values.Additionally, each phone forms the candidate sets of all incomplete phones using the information from M R (Lines 3-6).The candidate messages are also sorted by the number of phones that have received them (Line 5).In our algorithm, therefore, the first message in each candidate set is the most wanted messages.The main message selection process is in Lines 7-12.he loop starts from the phone with the highest priority to the one with the lowest priority.Within the loop, each phone (p a ) picks the first message (C a [1]) in the candidate set for updating message in the second stage.Accordingly, all other incomplete phones with lower priorities update their candidate sets by removing C a [1] to avoid redundant message selections.Eventually, for a phone p i , msg i = C i [1] will be the message to be put on the device name.The time complexity of Algorithm 1 is bounded by O(n 2 ).
Message update for complete phones: The algorithm for a complete phone to update message is similar to Algorithm 1. Due to the page limit, we omit the pseudo-codes here.Each phone needs to construct the set of all complete phones CP and derive the candidate message set for each of them.An extra step for a complete phone is that it has to execute Algorithm 1 before making its own choice.All the messages that have been selected by incomplete phones will be eliminated from complete phones' candidate sets.The remaining messages in the candidate set are also sorted according to the number of phones that need them.As same as in Algorithm 1, each phone selects the first message in the sorted list of candidate messages.

C. Network Management with Parameter Optimization
From the analysis above, the update interval(α) is crucial to the performance of PASA system.In this subsection, we present the network management through analyzing the performance of the solution above and derive the optimal value of α for the first stage.Essentially, we aim to express the objective as a function on α.Our analysis is based on a general function P(x, y) defined to represent the probability that a phone with scan interval of x can receive a message from another phone with update interval of y.In another word, P(T i , U j ) is the reception probability for p i to receive a message from p j .We will present how to calculate P(x, y) in Section V.
We use the following Theorem to estimate the execution time for each phone to receive all messages, i.e., the value of t i .Theorem 2. The execution time for phone p i to receive all messages is expected to be where kmax is largest value of k i , and let Proof: Let us consider the time point when the last phone finishes its first stage, i.e., the phone with the most messages.Let kmax = max{k i } Each phone p i has missed (1 − P(T i , α)) • ∑ i̸ =j k j messages from their owners (while in the first stage).However, some phones have broadcast messages in their second stage which guarantees a success delivery at all other nodes.In total, there have been messages in the second stage.We assume they evenly contribute to each phone's collecting process, i.e., each phone obtain at least c2 n missing messages.For each message m, the probability that it has not been scanned by all the phones when the last phone enters the second stage is where the first term is the probability that m has not been scanned by all phones in the first stage and the second term is the probability that m is not one of the c 1 messages broadcast in the second stage.Therefore, there are c 2 = (1− candidate messages that can be put on device names in the second stage.Assume each phone picks a distinct message in the first round of second stage.For a particular message that p i needs, there is a probability of n−1 c2 to be scanned after the first round.In the second round, the expected number of total candidate messages becomes c 2 − n and each message p i needs has a probability of n−1 c2−(n−1) to be collected.This process is repeated until p i obtains all the messages.Therefore, p i is expected to use r rounds in the second stage to collect all messages, such that Eventually, the execution time for phone p i is Since the value of α is upper-bounded by T n + 2 • S, we can enumerate all possible values and derive the best value leading to the minimum ∑ i t i according to the above Theorem 2.

V. ANALYSIS OF MESSAGE RECEPTION PROBABILITY
In this section, we analysis the message reception probability P(x, y) which is a critical building block for deriving the optimal parameters in our solution.
Based on Theorem 1, P(x, y) = 1 if y ≥ x + 2 • S. The following analysis is under the condition of y < x + 2 • S. The message reception probability depends on ont only the two input parameters x and y which indicate the length of scan interval and update interval (the message's active period), but also the schedule of scanning and update processes, i.e, the start points of the phone's (p i ) scanning phase and the message's (m) active period.Therefore, we need to consider several basic possible cases as follows.The probability that p i can receive m is y S .Case B: The active period of m is within p i 's idle phase.The probability that p i can receive m is 0. Case C: The active period of m starts during p i 's scanning phase and ends in the consecutive idle phase.In this case, the reception probability depends on the different between the beginning of the scanning phase and that of m's active period.Let δ ∈ [0, S] indicate that offset.Thus, the probability that p i can receive m is 1 − δ S .Case D: The active period of m starts during p i 's idle phase and ends in the consecutive scanning phase.This case is similar to Case C and the reception probability depends on overlap of the scanning phase and m's active period.Let δ ∈ [0, S] be the difference between the start of the scanning phase and the end of the active period.The probability that p i can receive m is δ S .Case E: The active period of m starts in p i 's idle phase and ends in p i 's next idle phase.In this case the reception probability is 1.Case F: The active period of m starts in p i 's scanning phase and ends in p i 's next scanning phase.In this case, p i could possibly receive m in both scanning phases.Let δ ∈ [0, S] represent the different between the start of the first scanning phase and that of m's active period.Then the probability that p i receives m in the first scanning phase is 1 − δ S .In the second scanning phase, the overlap with the active period, i.e., between the start of the second scanning phase and the end of m's active period, is y −x−(S −δ).Thus, the probability that p i receives m in the second scanning phase is y−x−(S−δ) S = y−x+δ S − 1. Combing these two scanning phases, therefore, the probability that p i can receive m (in at least one of the scanning phases) is Proof: We consider a scanning phase followed by a idle phase as a repeating round for phone p i and the message active period could start at any point in this round.When y ∈ [x + S, x + 2 • S), as shown in Fig. 6, we can classify all possible scenarios into two conditions based on the starting point of m's active period.In Condition 1, the active period starts in p i 's scanning phase with a offset from the beginning of the scanning phase to a point where the active period ends at the end of the next scanning phase.Condition 2 is the complementary of Condition 1. Apparently, the reception probability under Condition 2 is 1 because the active period covers a complete scanning phase (Case H).On the other hand, Condition 1 refers to Case F above and the difference from the start of the scanning phase ranges from 0 to u = x + 2 • S − y.Therefore, the reception probability is Theorem 4. When y ∈ [x, x + S) Proof: Let SP 1 and SP 2 be the closest scanning phase before and after the message active period starts, i.e., SP 1 belongs to the round, but SP 2 does not.Under the condition of y < x + S, the message active period could overlap with either SP 1 or SP 2 or both of them.Let δ be the offset of the message active period compared to the start of a round.We derive P(x, y) based on the analysis of the following three cases: (1).The message active period only overlaps with SP 1 , but not SP ).The message active period overlaps with both SP 1 and SP 2 .In this case, δ ranges from x + S − y to S. The lengths of the overlaps with SP 1 and SP 2 are S − δ and δ + y − x − S respectively.Referring Case F, the message reception probability is Therefore, when y ∈ [x, x + S), Theorem 5. When y ∈ (0, x) Proof: The proof is similar to the above proof of Theorem 4.Under the condition of y < x, the message active period could overlap with either SP 1 or SP 2 .Let δ be the offset of the message active period compared to the start of a round.We derive P(x, y) based on the analysis of the following two cases: (1).The message active period only overlaps with SP 1 .This case refers to Case A and Case C and δ ranges from 0 to S + x − y, the message reception probability is min{S−δ,y} S .
(2).The message active period only overlaps with SP 2 .This case refers to Case D and Case E. The message reception probability is δ+y−S−x S when δ ∈ [S, x + 2 • S − y] (Case D).Therefore, following the above proof of Theorem 4, when y < x,

VI. PROBLEM SETTING WITH OFF STATE
In the previous sections, we consider the phones' Bluetooth modules are always "ON".However, in reality, some users may want to save energy on each application to maintain a longer battery life, especially disaster victims.Thus, for each phone, it may have a energy budget.In order to meet the energy budget per unit constraint, we assume that phones can turn off their Bluetooth modules periodically.Now, we define the following three operations for each phone.
• OFF state: In OFF state, the Bluetooth module on the mobile device is turned off.Therefore, it cannot interact with the nearby devices to receive or deliver messages.Consequently, the system does not require any energy from the smartphone.• IDLE state: In IDLE state, the smartphone can only deliver messages to others and does not receive any messages from the nearby mobile devices.• SCAN state: In SCAN state, the nodes can not only initial communication to the nearby smartphones to receive messages but also response to others' scan to deliver its own messages.Apparently, the power consumption of the Scan, Idle and OFF states are different.Clearly, during the OFF state, there is no energy cost required from the smartphone.Fig. 7 shows a sample schedule including these three operations.In each "ON" period, it can contain one or multiple Scans and Idles.

A. Message Format with OFF state
In our solution, the device name is divided into two segments, header and payload.Similar to other network protocol, 'header' field contains control and management data and 'payload' stores the messages being broadcast.For a phone i, the header should includes its schedule of the state transitions and current message reception state.Besides message reception feedback and index range of active messages fields as described in section III, the message format with OFF state introduces the following new fields: • A i : each phone uses two bytes to indicate the time stamp when the Bluetooth device was most recently turned on and became active.• L on i and L of f i : each phone uses two bytes to illustrate the length of the Bluetooth device's active period (the device is on) and the length of its inactive period (the device is off).
• I i : each phone uses one byte to express the time interval between two consecutive scans when the Bluetooth device is on, i.e., the gap between the end of the previous scan and the beginning of the next scan.

B. Parameter Optimization with OFF state
During the initial scan, phones exchange their scheduling parameters, including lengths of "ON" and "OFF" state.We assume that, for an incomplete phone, the beginning of each "ON" period is a Scan operation and the.The Scan operation has a fix length naturally and as in the previous problem setting, the Idle operation is configured to be one particular value.Therefore, after exchanging the length of each "ON", "OFF" and "Idle", phones can calculate each other's scheduling.
where, L scan is a naturally fix value for all phones, L idle and L ON are the length of each phone's Idle and ON states.N scan and N idle are the number of Scans and Idles during ON state.Since each ON state starts with a Scan operation and every Idle has a previous Scan operation, we have N scan = N idle or N scan = N idle + 1.Therefore, we can derive the values of N scan and N idle .
After deriving the number of Scans and Idles, we start analyzing the minimum update interval which can ensure others receive this message.As shown above, the relationship between N scan and N idle can be either N scan = N idle + 1 or N scan = N idle .According to the setting of ON period, N scan = N idle + 1 indicates that the ON period starts and ends with a Scan operation.If N scan = N idle +1, it starts with a Scan and ends with an Idle operation.Now, we analyze the minimum update interval for both cases.
• N scan = N idle + 1: The message that actives for at least minimum update interval ensures the reception by others.This is achieved by covering at least one complete Scan state.Fig. 8 shows a sample setting in this case.The analysis in the previous section shows that if the phones always stay on, L idle + 2 * L scan is the minimum update interval as shown in Fig. 8   Case I: The active period of m starts during p i 's last scanning phase and ends in the following "OFF" state.In this case, the reception probability depends on the difference between the beginning of the scanning phase and that of m's active period.Let δ ∈ [0, S] indicates the offset, thus, the probability that p i can receive m is 1 − δ S .Case J: The active period of m starts during p i 's "OFF" State and ends in the following Scan phase.Similar to Case I, the reception probability depends on the overlap of Scan phase and m's active period.Let δ ∈ [0, S] be the overlap, the reception probability that p i can receive message m is δ S .Case K: The active period of m starts during the last scan phase before "OFF" state and ends during the first scan phase after "OFF" state.Let δ ∈ [0, S] represent the difference between the start of the last scanning phase before "OFF" and that of m's active period.Then the probability that p i receives m in the first scanning phase is 1 − δ S .In the second scanning phase, the overlap with the active period, i.e., between the start of the second scanning phase and the end of m's active period, is y−L of f i −(S−δ).Thus, the probability that p i receives m in the second scanning phase is Combing these two scanning phases, therefore, the probability that p i can receive m (in at least one of the scanning phases) is Cases Case O: The active period of m starts in the last idle phase before "OFF" state and ends in the following "OFF" state.Since both idle phase and "OFF" state cannot receive message from others, the reception probability for p i to receive m is 0. Case P: The active period of m starts and ends within the "OFF" period.Similar to the previous case, the reception probability is 0 for p i to receive message m.
Case Q: The active period of m starts during the last idle phase before "OFF" state and ends during the first scan phase after "OFF".Let δ ∈ [0, S] be the overlap of m's active period and the first scan phase after "OFF".Then, the reception probability for p i to receive m is δ S .Case R: The active period of m start within the last scan phase before "OFF" and ends in the first scan phase after "OFF".This case is similar with case F and K except the interval between two scans is L idle i + L OF F i .Therefore, the reception probability for p i to receive m is, Case S: The active period of m starts during the last scan phase and ends within the following "OFF" state.Let δ ∈ [0, S] be the difference between the beginning of the scan phase and that of m's active period.The reception probability for p i to receive m is 1 − δ S .Case T: The active period of m starts during the last idle phase before "OFF" and ends during the first idle phase after "OFF" state.This active period completely contains the first scan phase after "OFF".Thus, the reception probability for p i to receive m is 1.

VII. IMPLEMENTATION AND EVALUATION
In this section, we will first introduce the system implementation of our PASA system and then present the performance evaluation results from both smartphones experiments and simulation.

A. System Implementation
We choose Android operating system as our development environment, and have implemented PASA on different brands of smartphones and tablets, including Nexus 7, Nexus 4 and Samsung Galaxy Nexus.Our prototype system is built on Android Jelly Bean(specific version 4.2.2),API level 17.PASA system does not require any change on Bluetooth driver or Android kernel.
In our experiments, we integrate PASA with Twitter to demonstrate application functions.A user can choose to pull online tweets for local dissemination or push local messages to his Twitter account.As a result, when a user starts PASA for the first time, he needs to authorize the application to use his Twitter account and configure his own profile (e.g., name, number of messages to share and length of idle duration).Fig. 12 and Fig. 13 show the user interfaces of our PASA system.
The system mainly performs the following operations: (1) input and publish message to Twitter, nearby users or both (Twitter, BLocal and BTwitter on Fig. 12 correspondingly), (2) set or change configurations, (3) scan the nearby users to receive messages, (4) generate and transmit feedback to inform other users which messages it currently holds, and (5) view one specific local user's shared message.
In addition, we develop a simulator to evaluate a system with a large number of smartphones.For both experiments and simulation, we set the length of a scanning phase to be 10 seconds, i.e., S = 10.

B. Performance Evaluation
In this subsection, we present evaluation results from both Android smartphones experiments (small scale) and simulation (large scale).The major performance metric we exam is the average complete time among all smartphones in the network (which is equivalent to the objective function in our algorithm design ∑ i t i ).We set up a small testbed with 5 Android phones running our program.We consider the following four different cases for our evaluation.
• Case 1: All participated smartphones have the same scan interval(T i ) and number of messages(k i ); • Case 2: They have different T i but the same k i ; • Case 3: They have different k i but the same T i ; • Case 4: Both T i and k i are different.Fig. 14a shows the average complete time in Case 1 with varying α.In this setting, each smartphone has 10 messages(k i = 10) to share and their scan intervals is 5s(T i = 5).We change α from 5s to 40s with a interval of 5s.For each parameter setting, we repeat the experiment for 5 times and present the average value in Fig. 14a.The error bar indicates the maximum and minimum complete time observed in our tests.As shown in the figure, with 3 phones, the best value of α is 15; with 4 or 5 phones the best results are achieved when α = 20.Intuitively, a smaller α causes low message reception rate in the first stage leading to more messages disseminated in the second stage; on the other hand, a larger α increase the execution time of the first stage.Therefore, there are pivot points in all three curves.Our analytical model derives the optimal values of α to be 18, 19, 19 respectively for n = 3, 4 and 5.This estimation matches well with the experimental results which shows our analysis is accurate and effective, thus can help users find the best value of α for the PASA system.Another observation from Fig. 14a is that when α is small, the average complete time of each phone varies a lot.This is because the expected message reception probability is low which indicates that it is likely to miss such a message during the first stage.14d very well.The battery life is an important metric that directly affect the relief and victims.We measure the power consumption in terms of Battery Percentage Usage (BPU).Five different cases have been tested on our testbed for five times each, PASA with 10-second idle(1), PASA with 10second idle and 10-second OFF state(2), WiFi Browsing(3), WiFi Direct transmission(4), Bluetooth transmission (5).The Fig. 15 shows the average cost of BPU of under different cases.As we can see from the figure, PASA with OFF state outperforms other experiments.The reason is that, in PASA-Off, the active time is 33% less than PASA.
2) Simulation Results: To evaluate a large scale network, we conduct simulation to test the performance of PASA.Our goal is to study the impact of the number of phones on the system performance.Fig. 16 shows the average complete time with k i = 10 and T i = Random [5,35] over different number of smartphones in the network.The number of phones ranges from 5 to 50, and the average complete time fluctuates between 500 and 600 which is very small comparing with the number  [5,35] Fig. 16.Average complete time with different numbers of phones (n), while k i = 10 for all smartphones and T i = Random [5,35] of total messages increase.This is caused by the many-toone communication during each scan.Increasing the number of phones does not increase the average complete time much which indicates passive broadcast is certainly a scalable model.Fig. 17a shows the average complete time for 10, 15, 20, and 50 smartphones.We find that for α ≥ 30, the five curves are almost coincide with each other.The reason is that α already reaches T n +2•S.According to Theorem 1, this update interval is sufficiently long such that every other phone can certainly receive every message during the first stage.From our theoretical model, the optimal value for these settings are 24, 26, 22, 23 for n = 10, 15, 20, 50.Comparing to Fig. 17a, our model can yield a good value of α for PASA system in these settings.
Fig. 17b shows the result when k = 10 for everyone and each phone randomly choose a T i in [5,35].In our tested cases, for n = 10, 15, 20, 50 the maximum T i is 29, 28, 21, 35 respectively.The theoretical optimal value of those four settings are 20, 26, 25, 33.Finally, Fig. 17c shows a general scenario where a user's k i and T i are randomly chosen from a given range, 5 to 30 in our setting.The following table shows the specific setting of our test.With the details of each setting, our theoretical model gives the optimal value of α as 29, 25, 26, 34.Besides showing the accurate estimation of α, we further present a comparison to a simple message rotation scheme to show the advantage of our two-stage algorithm.In the rotation scheme, each phone rotates its own messages cyclically with the update interval α, i.e., repeating the first stage defined in our solution.We conduct a test with exactly the same (c) ki = Random [5,30], Ti = Random [5,30]  parameter setting with Fig. 17c and the results are illustrated in Fig. 18.Note that we set a upper bound of 10,000 seconds for the execution time in our simulation and the missing values in Fig. 18 indicate that the simulation for those settings exceeds the upper bound of the execution time.Comparing to Fig. 17c, we observe that our two-stage PASA system significantly reduce the average complete time especially when α is small.Our solution is more robust to a misconfigured α.Even when α is not set to the optimal value, PASA system can mitigate the negative impact on the performance.
Next, we present the results for PASA with OFF state that can benefit the disaster victims with low battery percentages.In these simulations, the smartphones randomly choose an OFF state length within the range of 0 to 20 seconds.Fig. 19a and 19b illustrate the performance for case 1 and 4. Comparing with the same cases in Fig 17, we have two observations.First, PASA-Off's the average complete time is much longer than PASA.By introducing the OFF state, not only reduces the the total length of active duration in each smartphone, but also significantly decreases reception probabilities.Second, for consecutive α, the average complete time jitters.This is because the smartphone randomly picks up a length of OFF state that results in a large difference of the update intervals of the second stage.The theoretical optimal value of those four settings of PASA-Off in Fig 19a are 26, 37, 34, 28 which, we can see, are at the bottom.

VIII. DISCUSSIONS AND FUTURE WORK
In this section, we discuss some limitations of our solution and possible extensions and future work.
First, our solution can be extended to a more general multi-stage protocol to further improve the performance.The two-stage solution in this paper is an extreme case where the second stage use the most conservative message update interval that is reasonable for post-disaster communication.An advanced approach would be a multi-stage solution, where the update interval is dynamic across the stages.
In addition, the problem setting can be relaxed to assume a general connected network topology where messages are spread in a multi-hop fashion.The problem objective would be adjusted accordingly and the analysis is expected to be more complicated.But our work in this paper can certainly serve as a starting point for this problem.

IX. CONCLUSION
This paper develops PASA, a local message dissemination system based on passive broadcast model.We present a twostage protocol for propagate messages and provide in-depth analysis to derive the optimal update interval value.We have implemented our solution on Android phones and evaluated it with experiments and simulation.The results show that PASA system is effective and efficient for disseminating local messages.(b) ki = Random [5,30], Ti = Random [5,30]

Fig. 1 .
Fig. 1.Passive Broadcast Model Our main contributions are as follows: • We propose to use a new communication model, passive broadcast, to carry out short messages for local data dissemination.• We develop a complete communication system with a suite of protocols and power-saving mode to efficiently spread messages in the proximity.• We study the 'scan' management which is crucial to the proposed network model and analyze the performance to derive the best parameters to minimize the complete time.• We prototype the system on commercial phones and evaluate it with comprehensive experiments on the testbed and simulation.
Fig 2 illustrates the major components in the architecture of PASA.

Algorithm 1
Choose the Message for Incomplete Phone p i 1: Identify all incomplete phones (construct IP ) 2: Sort the set IP in the descending order of each phone's priority 3: for each incomplete phone p u do 4:Construct its candidate set C u 5:

Fig. 4 .
Fig. 4. Cases A∼FCase A: The active period of m is within p i 's scanning phase.The probability that p i can receive m is y S .Case B: The active period of m is within p i 's idle phase.The probability that p i can receive m is 0. Case C: The active period of m starts during p i 's scanning phase and ends in the consecutive idle phase.In this case, the reception probability depends on the different between the beginning of the scanning phase and that of m's active period.Let δ ∈ [0, S] indicate that offset.Thus, the probability that p i can receive m is 1 − δ S .Case D: The active period of m starts during p i 's idle phase and ends in the consecutive scanning phase.This case is similar to Case C and the reception probability depends on overlap of the scanning phase and m's active period.Let δ ∈ [0, S] be the difference between the start of the scanning phase and the end of the active period.The probability that p i can receive m is δ S .Case E: The active period of m starts in p i 's idle phase and ends in p i 's next idle phase.In this case the reception probability is 1.Case F: The active period of m starts in p i 's scanning phase and ends in p i 's next scanning phase.In this case, p i could possibly receive m in both scanning phases.Let δ ∈ [0, S] represent the different between the start of the first scanning phase and that of m's active period.Then the probability that p i receives m in the first scanning phase is 1 − δ S .In the second scanning phase, the overlap with the active period, i.e., between the start of the second scanning phase and the end of

Fig. 5 .Theorem 3 .
Fig. 5. Case G and Case H Case G: The active period of m starts in p i 's idle phase and ends in the second consecutive scanning phase.The reception probability is obviously 1. Case H: The active period of m starts in p i 's scanning phase and ends in the second consecutive idle phase.The reception probability is also 1. Above all, we derive the value of P(x, y) under three different conditions in the following Theorem 3, Theorem 4, and Theorem 5 with The details of the proof.Theorem 3. When y ∈ [x + S, x + 2 • S) P(x, y) = 1 − 1 x + S

2 .
This case refers to Case A and Case C and δ ranges from 0 to S + x − y, the message reception probability is min{S−δ,y} S .(2).The message active period only overlaps with SP 2 , but not SP 1 .This case refers to Case D, Case E and Case G.The message reception probability is δ+y−S−x S when δ ∈ [S, x + 2 • S − y] (Case D).The message reception probability is 1 when δ ∈ [x + 2 • S − y, x + S].Therefore, let v = x + S − y, the message reception probability is ∑ δ∈[S,v+S) Fig. 7. Three States

Fig. 9 .Fig. 10 .
Fig. 9. Minimum update interval for Nscan = N idle From the above analysis, we can determine the minimum update interval after the initial scan.Besides the cases A∼H that present in Fig 4 and 5, we have a 12 more cases with the new setting as shown in Fig 10 and 11.

Fig. 12 .
Fig. 12. Main page Fig. 13.Message list Fig. 14b shows a result for Case 2, where k i = 10 and T i is set to 10,15,20,25,30 respectively.Based on the experiments, the best tested values of α are 25,30,30 for n = 3, 4, 5. Our theoretical model derives 26, 26, and 30 as the optimal values which are very close to the experimental results.Fig. 14c and Fig. 14d illustrate the experimental results for Case 3 and Case 4 in our evaluation.In addition, we conduct simulation with the same setting to confirm the accuracy of our own simulator.We use 'Exp' and 'Sim' in the legend to represent the experimental and simulation results respectively.

Fig. 19 .
Fig. 19.Average complete time of PASA-Off with different α (simulation) It is a distributed and collaborative algorithm for each phone to decide how to scan nearby peers and update messages, where the process of updating messages includes not only the schedule but also the message selection strategy.

table .
n/p i number of smartphones/the i-th phone T i /U i scan interval / update interval of p i S execution time of one scan t i execution time for p i to receive all messages f a function converts a MAC address to a numerical value k i number of messages generated by p i M set of all message IDs in the network

TABLE I NOTATIONS
case A. However, it is different after we introduced "OFF" state.If the L idle + 2 * L scan , is less than L OF F + 2 * L scan , this active length can not ensure to cover at least one complete Scan operation, as shown in Fig. 8 case B. Therefore, in this case, the minimum update interval should be max{L idle + 2 * L scan , L OF F + 2 * L scan }. • N scan = N idle : In this setting, the "ON" state starts with a Scan and ends with a Idle operation.Case A, in this scenario, is the same with the previous one, however case B is different.Since "OFF" state is always behind a Idle operation, the case B should be L idle +2 * L scan < L idle + L OF F + L scan .Therefore, similar to the previous result, in this scenario, the minimum update interval should be max{L idle + 2 * L scan , L idle + L OF F + L scan }.