Click here to Skip to main content
15,893,161 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to use desktop composition + C# Pin
BobJanova25-Jun-12 4:52
BobJanova25-Jun-12 4:52 
GeneralRe: how to use desktop composition + C# Pin
jojoba201125-Jun-12 17:51
jojoba201125-Jun-12 17:51 
Questionascii to decimal Pin
Member 916404524-Jun-12 8:29
Member 916404524-Jun-12 8:29 
AnswerRe: ascii to decimal Pin
Luc Pattyn24-Jun-12 8:53
sitebuilderLuc Pattyn24-Jun-12 8:53 
AnswerRe: ascii to decimal Pin
NeonMika24-Jun-12 10:29
NeonMika24-Jun-12 10:29 
GeneralRe: ascii to decimal Pin
Member 916404524-Jun-12 17:08
Member 916404524-Jun-12 17:08 
AnswerRe: ascii to decimal Pin
Luc Pattyn24-Jun-12 17:50
sitebuilderLuc Pattyn24-Jun-12 17:50 
GeneralRe: ascii to decimal Pin
Basim 227-Jun-12 10:21
Basim 227-Jun-12 10:21 
Hi Luc, I have tried to read the data but no luck. I wrote the following small test program to store the received data in a text file. The data that i want to receive is a binary data packet from the Zephyr Heard Rate Monitor device through a bluetooth. The device sends 60 byte packet every 1 second. The packet format is shown in section 7 of the following following Bluetooth HXM API Guide 2011-05-05.pdfpdf file:https://www.box.com/shared/c169gssedk2nrgu4t41f[^]

C#
namespace ReadZaphyr
{
    public partial class Form1 : Form
    {
        StreamWriter sw = new StreamWriter(@"C:\\myfile.txt");
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (!serialPort1.IsOpen)
            {
               serialPort1.PortName = "COM6";
               serialPort1.BaudRate = 115200;
               serialPort1.Open();
               serialPort1.DataReceived += serialPort1_DataReceived;

            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            if (serialPort1.IsOpen)
            {
                serialPort1.Close();
            }
            sw.Close();
            sw.Dispose();
            this.Close();
        }

        private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            Thread.Sleep(100);
            byte[] buffer = new byte[serialPort1.ReadBufferSize];
            int count = serialPort1.Read(buffer, 0, buffer.Length);
            for (int i = 0; i < buffer.Length; i++)
            {
                sw.Write(buffer[i].ToString());
            }
        } 
   }
}

AnswerRe: ascii to decimal Pin
Luc Pattyn27-Jun-12 11:17
sitebuilderLuc Pattyn27-Jun-12 11:17 
GeneralRe: ascii to decimal Pin
Richard MacCutchan24-Jun-12 22:35
mveRichard MacCutchan24-Jun-12 22:35 
GeneralRe: ascii to decimal Pin
Basim 225-Jun-12 4:41
Basim 225-Jun-12 4:41 
QuestionUnhanded Exception Error Pin
Saidrex23-Jun-12 22:42
Saidrex23-Jun-12 22:42 
AnswerRe: Unhanded Exception Error Pin
Sandeep Mewara23-Jun-12 22:57
mveSandeep Mewara23-Jun-12 22:57 
GeneralRe: Unhanded Exception Error Pin
Saidrex23-Jun-12 23:36
Saidrex23-Jun-12 23:36 
GeneralRe: Unhanded Exception Error Pin
Sandeep Mewara24-Jun-12 2:28
mveSandeep Mewara24-Jun-12 2:28 
GeneralRe: Unhanded Exception Error Pin
Saidrex24-Jun-12 2:32
Saidrex24-Jun-12 2:32 
AnswerRe: Unhanded Exception Error Pin
Eddy Vluggen23-Jun-12 23:40
professionalEddy Vluggen23-Jun-12 23:40 
GeneralRe: Unhanded Exception Error Pin
Saidrex24-Jun-12 0:09
Saidrex24-Jun-12 0:09 
GeneralRe: Unhanded Exception Error Pin
Eddy Vluggen24-Jun-12 0:14
professionalEddy Vluggen24-Jun-12 0:14 
GeneralRe: Unhanded Exception Error Pin
Saidrex24-Jun-12 0:17
Saidrex24-Jun-12 0:17 
GeneralRe: Unhanded Exception Error Pin
Eddy Vluggen24-Jun-12 0:25
professionalEddy Vluggen24-Jun-12 0:25 
GeneralRe: Unhanded Exception Error Pin
Saidrex24-Jun-12 0:32
Saidrex24-Jun-12 0:32 
GeneralRe: Unhanded Exception Error Pin
jschell24-Jun-12 12:27
jschell24-Jun-12 12:27 
QuestionDelete specific rows from database tables Pin
Saidrex23-Jun-12 10:16
Saidrex23-Jun-12 10:16 
AnswerRe: Delete specific rows from database tables Pin
Abhinav S23-Jun-12 18:22
Abhinav S23-Jun-12 18:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.