| Algorithm 1: Respiratory data analysis algorithm. |
|
Input: collected respiratory data collection “cache” Output: Hexadecimal respiratory data set “lungData” 1. if cache.Count!=0 then 2. for int i = cache.Count-1; i >= 0; i– do 3. if i! = 0 then 4. if cache[i] == 0xc1&&cache[i-1] == 0xf0 then 5. Array.Copy(cache.ToArray(),i + 1,endData,0,endData.Length) 6. isReceived = true 7. cache.Clear() 8. if isReceived then 9. for int i = 0; i < endData.Length; i++ do 10. if i < 22 &&i % 2 == 0 then 11. hex += endData[i].ToString(“X2”) 12. hex += endData[i + 1].ToString(“X2”) 13. lungData.data.Add(Explain(hex)) 14. else if i < 25 then 15. hex += endData[i].ToString(“X2”) 16. data.Add(Explain(hex)) 17. lungData.GetDetail() |