using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SmartDevice.Connectivity;
using System.Collections.ObjectModel;
namespace sample1
{
class Program
{
static void Main(string[] args)
{
//Instead of 1033 use the locale ID of your app.
DatastoreManager dsmgrObj = new DatastoreManager(1033);
//Get all the platform entries present in Data store
//Iterate through Collection of platforms
Collection<Platform> platformCollection = dsmgrObj.GetPlatforms();
foreach (Platform objplatform in platformCollection)
{
System.Console.WriteLine(objplatform.Name);
Collection<Device> deviceCollection = objplatform.GetDevices();
//List all the devices in the platform
foreach (Device objdevice in deviceCollection)
{
System.Console.WriteLine("\t" + objdevice.Name);
}
}
}
}
}
Let’s look at some options to connect to a device and get info regarding the device.
In the below sample I am connecting to PPC 05 emulator and getting info regarding virtual and physical memory. IDs of devices/SDK can be obtained from the datastore files which can be found in
<sysDrive>:\Documents and Settings\<username> \Local Settings\Application Data\Microsoft\CoreCon\1.0 (Non Vista OS) or <sysDrive>:\users\<username>\Application data\Microsoft\CoreCon\1.0 (Vista)
Open the conman_ds_platform.xsl file in visual studio. This file contains the information about all the installed SDKs.
DatastoreManager dsmgrObj = new DatastoreManager(1033);
ObjectId ppc05PlatObjID = new ObjectId("4118C335-430C-497f-BE48-11C3316B135E");
ObjectId PPC05EmuID = new ObjectId("25D984D9-0DFE-4DB1-A5A0-9A4F660BF2CE");
Platform ppc05Plat = dsmgrObj.GetPlatform(ppc05PlatObjID);
Device ppc05Emu = ppc05Plat.GetDevice(PPC05EmuID);
//Connect to the device.
ppc05Emu.Connect();
SystemInfo pp05EmuInfo = ppc05Emu.GetSystemInfo();
System.Console.WriteLine("Available Physical Memoory\t:\t"+pp05EmuInfo.AvailPhys);
System.Console.WriteLine("Total Physical Memoory \t:\t" + pp05EmuInfo.TotalPhys);
System.Console.WriteLine("Available Virtual Memoory \t:\t" + pp05EmuInfo.AvailVirtual);
System.Console.WriteLine("Total Physical Memoory \t:\t" + pp05EmuInfo.TotalVirtual);
System.Console.WriteLine("OS Major number \t:\t" + pp05EmuInfo.OSMajor);
System.Console.WriteLine("OS Minor number \t:\t" + pp05EmuInfo.OSMinor);
--
Anand R