Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Reading Debug Information in Console App using MFDeployEngine


  • Please log in to reply
1 reply to this topic

#1 Thomas Rankin

Thomas Rankin

    Member

  • Members
  • PipPip
  • 26 posts

Posted 01 May 2012 - 01:27 AM

I like to wire up my device to log information that my computer can further process and send to other services like Pachube etc. I didn't want to bother setting up an USB RS232 cable and board. Through some research I found Chris Walker mention that you could tap into the MFDeployEngine, but I wasn't able to find any code to do so. So I did a little research, and found that it was quite simple really. MFDeploy turns out to be quite a powerful tool to interface with your NetMF Devices.

// Have to add references for MFDeployEngine.dll & Microsoft.SPOT.Debugger.dll

using System;
using Microsoft.NetMicroFramework.Tools.MFDeployTool.Engine;
using System.Threading;

namespace MFDeployEngineDataLogger
{
    class Program
    {
        static void Main(string[] args)
        {
            using (MFDeploy mfDeploy = new MFDeploy())
            {

                var devicePorts = mfDeploy.EnumPorts(TransportType.USB);
                if (devicePorts.Count != 0)
                {
                    using (MFDevice netduino = mfDeploy.Connect(devicePorts[0]))
                    {
                        if (netduino.DbgEngine.IsConnected)
                        {
                            netduino.DbgEngine.OnMessage += new Microsoft.SPOT.Debugger.MessageEventHandler(DbgEngine_OnMessage);
                            Thread.Sleep(Timeout.Infinite);
                        }
                        else
                        {
                            Console.WriteLine("Could not Connect");
                            Console.Read();
                        }
                    }
                }
            }
        }

        static void DbgEngine_OnMessage(Microsoft.SPOT.Debugger.WireProtocol.IncomingMessage msg, string text)
        {
            Console.Write(text);
        }
    }
}


#2 upak

upak

    New Member

  • Members
  • Pip
  • 1 posts

Posted 09 September 2012 - 07:23 PM

Hey Thomas, Did you use MFDeployEngine to store persistent data? I want to do that, but I don't know how. I don't know if I should update my firmware from 4.1 to 4.2, and I don't know where do I get the "MFDeployEngine.dll" file. Also, how can I make sure I'm not overriding some important data? Any help would be appreciated.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.