# HG changeset patch
# User sl
# Date 1360195803 -3600
# Node ID a77691c4006693d65f8e42fc448bd0a7345cdbad
First publish.
Write from C# named pipe server is working without using 100% CPU.
diff -r 000000000000 -r a77691c40066 CSNamedPipe/CSNamedPipe.sln
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CSNamedPipe/CSNamedPipe.sln Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSNamedPipe", "CSNamedPipe\CSNamedPipe.csproj", "{4B3BFED0-82D8-4540-857B-D8A727348CC9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4B3BFED0-82D8-4540-857B-D8A727348CC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4B3BFED0-82D8-4540-857B-D8A727348CC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4B3BFED0-82D8-4540-857B-D8A727348CC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4B3BFED0-82D8-4540-857B-D8A727348CC9}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff -r 000000000000 -r a77691c40066 CSNamedPipe/CSNamedPipe/CSNamedPipe.csproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CSNamedPipe/CSNamedPipe/CSNamedPipe.csproj Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,99 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.21022
+ 2.0
+ {4B3BFED0-82D8-4540-857B-D8A727348CC9}
+ Exe
+ Properties
+ CSNamedPipe
+ CSNamedPipe
+ v3.5
+ 512
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
\ No newline at end of file
diff -r 000000000000 -r a77691c40066 CSNamedPipe/CSNamedPipe/ClassDiagram1.cd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CSNamedPipe/CSNamedPipe/ClassDiagram1.cd Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,1 @@
+
\ No newline at end of file
diff -r 000000000000 -r a77691c40066 CSNamedPipe/CSNamedPipe/NamedPipeServer.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CSNamedPipe/CSNamedPipe/NamedPipeServer.cs Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,173 @@
+using System;
+using Microsoft.Win32.SafeHandles;
+using System.Text;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.IO;
+
+namespace CSNamedPipe
+{
+ public class NamedPipeServer
+ {
+ [DllImport("kernel32.dll", SetLastError = true)]
+ public static extern SafeFileHandle CreateNamedPipe(
+ String pipeName,
+ uint dwOpenMode,
+ uint dwPipeMode,
+ uint nMaxInstances,
+ uint nOutBufferSize,
+ uint nInBufferSize,
+ uint nDefaultTimeOut,
+ IntPtr lpSecurityAttributes);
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ public static extern int ConnectNamedPipe(
+ SafeFileHandle hNamedPipe,
+ IntPtr lpOverlapped);
+
+ [DllImport("kernel32.dll", SetLastError = true)]
+ public static extern int DisconnectNamedPipe(
+ SafeFileHandle hNamedPipe);
+
+ public const uint PIPE_ACCESS_DUPLEX = (0x00000003);
+ public const uint FILE_FLAG_OVERLAPPED = (0x40000000);
+ public const uint PIPE_ACCESS_OUTBOUND = (0x00000002);
+ public const uint PIPE_ACCESS_INBOUND = (0x00000001);
+
+ public class Client
+ {
+ public SafeFileHandle handle;
+ public FileStream stream;
+ }
+
+ public const int BUFFER_SIZE = 256;
+ public Client clientse =null;
+
+ public string pipeName;
+ Thread listenThread;
+ SafeFileHandle clientHandle;
+ public int ClientType;
+
+ public NamedPipeServer(string PName,int Mode)
+ {
+ pipeName = PName;
+ ClientType = Mode;//0 Reading Pipe, 1 Writing Pipe
+
+ }
+
+ public void Start()
+ {
+ this.listenThread = new Thread(new ThreadStart(ListenForClients));
+ this.listenThread.Start();
+ }
+ private void ListenForClients()
+ {
+ while (true)
+ {
+
+ clientHandle = CreateNamedPipe(this.pipeName, PIPE_ACCESS_OUTBOUND /*| FILE_FLAG_OVERLAPPED*/, 0, 255, BUFFER_SIZE, BUFFER_SIZE, 0, IntPtr.Zero);
+
+ //could not create named pipe
+ if (clientHandle.IsInvalid)
+ return;
+
+ int success = ConnectNamedPipe(clientHandle, IntPtr.Zero);
+
+ //could not connect client
+ if (success == 0)
+ return;
+
+ clientse = new Client();
+ clientse.handle = clientHandle;
+ clientse.stream = new FileStream(clientse.handle, FileAccess.Write, BUFFER_SIZE, false);
+
+ if (ClientType == 0)
+ {
+ Thread readThread = new Thread(new ThreadStart(Read));
+ readThread.Start();
+ }
+ }
+ }
+ private void Read()
+ {
+ //Client client = (Client)clientObj;
+ //clientse.stream = new FileStream(clientse.handle, FileAccess.ReadWrite, BUFFER_SIZE, true);
+ byte[] buffer = null;
+ ASCIIEncoding encoder = new ASCIIEncoding();
+
+ while (true)
+ {
+
+ int bytesRead = 0;
+
+ try
+ {
+ buffer = new byte[BUFFER_SIZE];
+ bytesRead = clientse.stream.Read(buffer, 0, BUFFER_SIZE);
+ }
+ catch
+ {
+ //read error has occurred
+ break;
+ }
+
+ //client has disconnected
+ if (bytesRead == 0)
+ break;
+
+ //fire message received event
+ //if (this.MessageReceived != null)
+ // this.MessageReceived(clientse, encoder.GetString(buffer, 0, bytesRead));
+
+ int ReadLength = 0;
+ for (int i = 0; i < BUFFER_SIZE; i++)
+ {
+ if (buffer[i].ToString("x2") != "cc")
+ {
+ ReadLength++;
+ }
+ else
+ break;
+ }
+ if (ReadLength > 0)
+ {
+ byte[] Rc = new byte[ReadLength];
+ Buffer.BlockCopy(buffer, 0, Rc, 0, ReadLength);
+
+ Console.WriteLine("C# App: Received " + ReadLength +" Bytes: "+ encoder.GetString(Rc, 0, ReadLength));
+ buffer.Initialize();
+ }
+
+ }
+
+ //clean up resources
+ clientse.stream.Close();
+ clientse.handle.Close();
+
+ }
+ public void SendMessage(string message, Client client)
+ {
+
+ ASCIIEncoding encoder = new ASCIIEncoding();
+ byte[] messageBuffer = encoder.GetBytes(message);
+
+ if (client.stream.CanWrite)
+ {
+ client.stream.Write(messageBuffer, 0, messageBuffer.Length);
+ client.stream.Flush();
+ }
+
+
+ }
+ public void StopServer()
+ {
+ //clean up resources
+
+ DisconnectNamedPipe(this.clientHandle);
+
+
+ this.listenThread.Abort();
+ }
+
+ }
+}
diff -r 000000000000 -r a77691c40066 CSNamedPipe/CSNamedPipe/Program.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CSNamedPipe/CSNamedPipe/Program.cs Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,32 @@
+using System;
+using System.Text;
+
+
+namespace CSNamedPipe
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ NamedPipeServer PServer1 = new NamedPipeServer(@"\\.\pipe\myNamedPipe1",0);
+ //NamedPipeServer PServer2 = new NamedPipeServer(@"\\.\pipe\myNamedPipe2",1);
+ NamedPipeServer PServer2 = new NamedPipeServer(@"\\.\pipe\sga-receiver", 1);
+
+
+ //PServer1.Start();
+ PServer2.Start();
+
+ string Ms="Start";
+ do
+ {
+ Console.WriteLine("Enter the message");
+ Ms = Console.ReadLine();
+ PServer2.SendMessage(Ms, PServer2.clientse);
+ } while (Ms != "quit");
+
+ PServer1.StopServer();
+ PServer2.StopServer();
+ }
+
+ }
+}
diff -r 000000000000 -r a77691c40066 CSNamedPipe/CSNamedPipe/Properties/AssemblyInfo.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/CSNamedPipe/CSNamedPipe/Properties/AssemblyInfo.cs Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("CSNamedPipe")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("CSNamedPipe")]
+[assembly: AssemblyCopyright("Copyright © 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9ca247ac-e153-4d77-b6ca-fbcfac32db9b")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff -r 000000000000 -r a77691c40066 ReadMe.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ReadMe.txt Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,55 @@
+========================================================================
+ WIN32 APPLICATION : SoundGraphAccess Project Overview
+========================================================================
+
+AppWizard has created this SoundGraphAccess application for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your SoundGraphAccess application.
+
+
+SoundGraphAccess.vcproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+SoundGraphAccess.cpp
+ This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+AppWizard has created the following resources:
+
+SoundGraphAccess.rc
+ This is a listing of all of the Microsoft Windows resources that the
+ program uses. It includes the icons, bitmaps, and cursors that are stored
+ in the RES subdirectory. This file can be directly edited in Microsoft
+ Visual C++.
+
+Resource.h
+ This is the standard header file, which defines new resource IDs.
+ Microsoft Visual C++ reads and updates this file.
+
+SoundGraphAccess.ico
+ This is an icon file, which is used as the application's icon (32x32).
+ This icon is included by the main resource file SoundGraphAccess.rc.
+
+small.ico
+ This is an icon file, which contains a smaller version (16x16)
+ of the application's icon. This icon is included by the main resource
+ file SoundGraphAccess.rc.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named SoundGraphAccess.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff -r 000000000000 -r a77691c40066 Resource.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Resource.h Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,31 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by SoundGraphAccess.rc
+//
+
+#define IDS_APP_TITLE 103
+
+#define IDR_MAINFRAME 128
+#define IDD_SOUNDGRAPHACCESS_DIALOG 102
+#define IDD_ABOUTBOX 103
+#define IDM_ABOUT 104
+#define IDM_EXIT 105
+#define IDI_SOUNDGRAPHACCESS 107
+#define IDI_SMALL 108
+#define IDC_SOUNDGRAPHACCESS 109
+#define IDC_MYICON 2
+#ifndef IDC_STATIC
+#define IDC_STATIC -1
+#endif
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NO_MFC 130
+#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 110
+#endif
+#endif
diff -r 000000000000 -r a77691c40066 SoundGraphAccess.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SoundGraphAccess.cpp Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,364 @@
+// SoundGraphAccess.cpp : Defines the entry point for the application.
+//
+
+#include "stdafx.h"
+#include "SoundGraphAccess.h"
+#include "iMONDisplayAPI.h"
+
+#define WM_DSP_PLUGIN_NOTIFY WM_APP + 1121
+#define MAX_LOADSTRING 100
+
+
+// Global Variables:
+HINSTANCE hInst = 0; // current instance
+TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
+TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
+HANDLE gThreadReceiver = 0;
+HANDLE gThreadSender = 0;
+BOOL gQuit=FALSE;
+
+LPTSTR gPipeNameSender = TEXT("\\\\.\\pipe\\sga-sender");
+LPTSTR gPipeNameReceiver = TEXT("\\\\.\\pipe\\sga-receiver");
+HANDLE gPipeSender=0;
+HANDLE gPipeReceiver=0;
+
+char gBufferReceiver[256];
+char gBufferSender[256];
+
+
+//
+BOOL m_bVfdConnected;
+BOOL m_bLcdConnected;
+
+// Forward declarations of functions included in this code module:
+ATOM MyRegisterClass(HINSTANCE hInstance);
+BOOL InitInstance(HINSTANCE, int);
+LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
+
+
+
+
+/**
+Read our pipe from this thread
+*/
+DWORD WINAPI ThreadReceiver( LPVOID lpParam )
+ {
+ //Create our pipe and listen
+ gPipeReceiver=CreateFile(gPipeNameReceiver, GENERIC_READ ,0,NULL,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,NULL);
+
+ while(!gQuit)
+ {
+ DWORD cbRead;
+ BOOL success=ReadFile(gPipeReceiver,gBufferReceiver,sizeof(gBufferReceiver),&cbRead, NULL);
+ if(success)
+ {
+ gBufferReceiver[cbRead]='\0';
+ OutputDebugStringA(gBufferReceiver);
+ }
+ if (!success && GetLastError() != ERROR_MORE_DATA)
+ {
+ OutputDebugStringA("Can't Read\n");
+ }
+ //
+ Sleep(500);
+ }
+
+ if (gPipeReceiver!=0)
+ {
+ CloseHandle(gPipeReceiver);
+ gPipeReceiver=0;
+ }
+
+ return 0;
+ }
+
+
+/**
+Write to our pipe from this thread
+*/
+DWORD WINAPI ThreadSender( LPVOID lpParam )
+ {
+ gPipeSender=CreateFile(gPipeNameSender, GENERIC_WRITE ,0,NULL,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,NULL);
+
+
+ if (gPipeSender!=0)
+ {
+ CloseHandle(gPipeSender);
+ gPipeSender=0;
+ }
+
+ return 0;
+ }
+
+
+/**
+*/
+int APIENTRY _tWinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPTSTR lpCmdLine,
+ int nCmdShow)
+{
+ UNREFERENCED_PARAMETER(hPrevInstance);
+ UNREFERENCED_PARAMETER(lpCmdLine);
+
+ // TODO: Place code here.
+ MSG msg;
+ HACCEL hAccelTable;
+
+ // Initialize global strings
+ LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
+ LoadString(hInstance, IDC_SOUNDGRAPHACCESS, szWindowClass, MAX_LOADSTRING);
+ MyRegisterClass(hInstance);
+
+ // Perform application initialization:
+ if (!InitInstance (hInstance, /*SW_HIDE*/ nCmdShow))
+ {
+ return FALSE;
+ }
+
+
+
+ hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SOUNDGRAPHACCESS));
+
+ // Main message loop:
+ while (GetMessage(&msg, NULL, 0, 0))
+ {
+ if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+
+ return (int) msg.wParam;
+
+ }
+
+
+void DisplayPluginMessage(UINT uErrCode, BOOL bError)
+ {
+ LPCTSTR strErrMsg = _T("");
+
+ if(bError)
+ {
+ switch(uErrCode)
+ {
+ case DSPN_ERR_IN_USED: strErrMsg = _T("Display Plug-in is Already Used by Other Application."); break;
+ case DSPN_ERR_HW_DISCONNECTED: strErrMsg = _T("iMON HW is Not Connected."); break;
+ case DSPN_ERR_NOT_SUPPORTED_HW: strErrMsg = _T("The Connected iMON HW doesn't Support Display Plug-in."); break;
+ case DSPN_ERR_PLUGIN_DISABLED: strErrMsg = _T("Display Plug-in Mode Option is Disabled."); break;
+ case DSPN_ERR_IMON_NO_REPLY: strErrMsg = _T("The Latest iMON is Not Installed or iMON Not Running."); break;
+ case DSPN_ERR_UNKNOWN: strErrMsg = _T("Unknown Failure."); break;
+ }
+ }
+ else
+ {
+ switch(uErrCode)
+ {
+ case DSPNM_PLUGIN_SUCCEED: strErrMsg = _T("Plug-in Mode Inited Successfully."); break;
+ case DSPNM_IMON_RESTARTED: strErrMsg = _T("iMON Started and Plug-in Mode Inited."); break;
+ case DSPNM_HW_CONNECTED: strErrMsg = _T("iMON HW Connected and Plug-in Mode Inited."); break;
+ }
+ }
+ //
+ OutputDebugString((LPCTSTR)strErrMsg);
+ }
+
+
+
+//
+// FUNCTION: MyRegisterClass()
+//
+// PURPOSE: Registers the window class.
+//
+// COMMENTS:
+//
+// This function and its usage are only necessary if you want this code
+// to be compatible with Win32 systems prior to the 'RegisterClassEx'
+// function that was added to Windows 95. It is important to call this function
+// so that the application will get 'well formed' small icons associated
+// with it.
+//
+ATOM MyRegisterClass(HINSTANCE hInstance)
+{
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = CS_HREDRAW | CS_VREDRAW;
+ wcex.lpfnWndProc = WndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = hInstance;
+ wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SOUNDGRAPHACCESS));
+ wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.lpszMenuName = MAKEINTRESOURCE(IDC_SOUNDGRAPHACCESS);
+ wcex.lpszClassName = szWindowClass;
+ wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
+
+ return RegisterClassEx(&wcex);
+}
+
+//
+// FUNCTION: InitInstance(HINSTANCE, int)
+//
+// PURPOSE: Saves instance handle and creates main window
+//
+// COMMENTS:
+//
+// In this function, we save the instance handle in a global variable and
+// create and display the main program window.
+//
+BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
+{
+ HWND hWnd;
+
+ hInst = hInstance; // Store instance handle in our global variable
+
+ hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
+
+ if (!hWnd)
+ {
+ return FALSE;
+ }
+
+ ShowWindow(hWnd, nCmdShow);
+ UpdateWindow(hWnd);
+
+ return TRUE;
+}
+
+//
+// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
+//
+// PURPOSE: Processes messages for the main window.
+//
+// WM_COMMAND - process the application menu
+// WM_PAINT - Paint the main window
+// WM_DESTROY - post a quit message and return
+//
+//
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ int wmId, wmEvent;
+ PAINTSTRUCT ps;
+ HDC hdc;
+
+ switch (message)
+ {
+ case WM_CREATE:
+ //IMON_Display_Uninit();
+ //IMON_Display_Init(hWnd, WM_DSP_PLUGIN_NOTIFY);
+ gThreadReceiver = CreateThread( NULL, 0, ThreadReceiver, NULL/*data pointer*/, 0, NULL);
+ gThreadSender = CreateThread( NULL, 0, ThreadSender, NULL/*data pointer*/, 0, NULL);
+ break;
+ case WM_COMMAND:
+ wmId = LOWORD(wParam);
+ wmEvent = HIWORD(wParam);
+ // Parse the menu selections:
+ switch (wmId)
+ {
+ case IDM_ABOUT:
+ DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
+ break;
+ case IDM_EXIT:
+ DestroyWindow(hWnd);
+ break;
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ break;
+ case WM_PAINT:
+ hdc = BeginPaint(hWnd, &ps);
+ // TODO: Add any drawing code here...
+ EndPaint(hWnd, &ps);
+ break;
+ case WM_DESTROY:
+ gQuit=TRUE;
+ //To complete write op
+ if (gPipeSender!=0)
+ {
+ CloseHandle(gPipeSender);
+ gPipeSender=0;
+ }
+ //To complete read op
+ if (gPipeReceiver!=0)
+ {
+ CloseHandle(gPipeReceiver);
+ gPipeReceiver=0;
+ }
+ WaitForSingleObject(gThreadSender,INFINITE);
+ WaitForSingleObject(gThreadReceiver,INFINITE);
+ CloseHandle(gThreadSender);
+ CloseHandle(gThreadReceiver);
+ //IMON_Display_Uninit();
+ PostQuitMessage(0);
+ break;
+ case WM_DSP_PLUGIN_NOTIFY:
+ switch(wParam)
+ {
+ case DSPNM_PLUGIN_SUCCEED:
+ case DSPNM_IMON_RESTARTED:
+ case DSPNM_HW_CONNECTED:
+ {
+ //GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE);
+ m_bVfdConnected = FALSE;
+ m_bLcdConnected = FALSE;
+ if((lParam & DSPN_DSP_VFD) == DSPN_DSP_VFD) m_bVfdConnected = TRUE;
+ if((lParam & DSPN_DSP_LCD) == DSPN_DSP_LCD) m_bLcdConnected = TRUE;
+ //UpdateControlUI();
+
+ DisplayPluginMessage(wParam, FALSE);
+ }
+ break;
+
+ case DSPNM_PLUGIN_FAILED:
+ case DSPNM_HW_DISCONNECTED:
+ case DSPNM_IMON_CLOSED:
+ {
+ //GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE);
+ m_bVfdConnected = FALSE;
+ m_bLcdConnected = FALSE;
+ //UpdateControlUI();
+
+ DisplayPluginMessage(lParam, TRUE);
+ }
+ break;
+
+ case DSPNM_LCD_TEXT_SCROLL_DONE:
+ {
+ //TRACE(_T("LCD Text Scroll Finished.\n"));
+ }
+ break;
+ }
+ return 0;
+ break;
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ return 0;
+}
+
+// Message handler for about box.
+INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ UNREFERENCED_PARAMETER(lParam);
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ return (INT_PTR)TRUE;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
+ {
+ EndDialog(hDlg, LOWORD(wParam));
+ return (INT_PTR)TRUE;
+ }
+ break;
+ }
+ return (INT_PTR)FALSE;
+}
+
diff -r 000000000000 -r a77691c40066 SoundGraphAccess.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SoundGraphAccess.h Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,3 @@
+#pragma once
+
+#include "resource.h"
diff -r 000000000000 -r a77691c40066 SoundGraphAccess.ico
Binary file SoundGraphAccess.ico has changed
diff -r 000000000000 -r a77691c40066 SoundGraphAccess.rc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SoundGraphAccess.rc Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,150 @@
+//Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+
+IDI_SOUNDGRAPHACCESS ICON "SoundGraphAccess.ico"
+IDI_SMALL ICON "small.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDC_SOUNDGRAPHACCESS MENU
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "E&xit", IDM_EXIT
+ END
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "&About ...", IDM_ABOUT
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDC_SOUNDGRAPHACCESS ACCELERATORS
+BEGIN
+ "?", IDM_ABOUT, ASCII, ALT
+ "/", IDM_ABOUT, ASCII, ALT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About SoundGraphAccess"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20
+ LTEXT "SoundGraphAccess, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
+ LTEXT "Copyright (C) 2013",IDC_STATIC,42,26,114,8
+ DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP
+END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 163
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 55
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#ifndef APSTUDIO_INVOKED\r\n"
+ "#include ""targetver.h""\r\n"
+ "#endif\r\n"
+ "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""windows.h""\r\n"
+ "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDC_SOUNDGRAPHACCESS "SOUNDGRAPHACCESS"
+ IDS_APP_TITLE "SoundGraphAccess"
+END
+
+#endif
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff -r 000000000000 -r a77691c40066 SoundGraphAccess.sln
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SoundGraphAccess.sln Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundGraphAccess", "SoundGraphAccess.vcproj", "{A23C5543-181D-41F3-892C-E8A0C7FFFE30}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A23C5543-181D-41F3-892C-E8A0C7FFFE30}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A23C5543-181D-41F3-892C-E8A0C7FFFE30}.Debug|Win32.Build.0 = Debug|Win32
+ {A23C5543-181D-41F3-892C-E8A0C7FFFE30}.Release|Win32.ActiveCfg = Release|Win32
+ {A23C5543-181D-41F3-892C-E8A0C7FFFE30}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff -r 000000000000 -r a77691c40066 SoundGraphAccess.vcproj
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SoundGraphAccess.vcproj Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,248 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 000000000000 -r a77691c40066 iMONDisplay.dll
Binary file iMONDisplay.dll has changed
diff -r 000000000000 -r a77691c40066 iMONDisplay.lib
Binary file iMONDisplay.lib has changed
diff -r 000000000000 -r a77691c40066 iMONDisplayAPI.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/iMONDisplayAPI.h Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,162 @@
+#ifndef __IMON_DISPLAY_API_H__
+#define __IMON_DISPLAY_API_H__
+
+////////////////////////////////////
+// includes
+/** iMONDisplayDefines.h
+This header file defines several enumerations. Open this file and check the definition and usage of enumerations and structures*/
+#include "iMONDisplayDefines.h"
+
+#ifdef IMON_DISPLAY_API_EXPORT
+#define IMONDSPAPI __declspec(dllexport)
+#else
+#define IMONDSPAPI __declspec(dllimport)
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif //__cplusplus
+
+ /////////////////////////////////////
+ ///// Interfaces
+ /**DSPResult IMON_Display_Init(HWND hwndNoti, UINT uMsgNotification)
+ @brief This function should be called to use other functions in iMON Display API.\n
+ When the caller application calls this function, API tries to request Display Plug-in Mode to iMON.
+ @param [in] hwndNoti API will send/post message to this handle.
+ @param [in] uMsgNotification API will send/post message to hwndNoti with this message identifier.
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_INVALIDARG or DSP_E_OUTOFMEMORY can be returned when error occurs.*/
+ IMONDSPAPI DSPResult IMON_Display_Init(HWND hwndNoti, UINT uMsgNotification);
+
+ /**DSPResult IMON_Display_Uninit()
+ @brief This function should be called when the caller application need not use this API any more.\n
+ If this function call is missed, iMON can't display other information.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded.*/
+ IMONDSPAPI DSPResult IMON_Display_Uninit();
+
+ /**DSPResult IMON_Display_IsInited()
+ @brief This function can be used when the caller application wants to know if API is initialized.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ If API is initialized, this call will return DSP_S_INITED. Otherwise DSP_S_NOT_INITED will be returned.*/
+ IMONDSPAPI DSPResult IMON_Display_IsInited();
+
+ /**DSPResult IMON_Display_IsPluginModeEnabled()
+ @brief This function can be used when the caller application wants to know if API can control iMON display.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ If API can control iMON display, this call will return DSP_S_IN_PLUGIN_MODE. Otherwise DSP_S_NOT_IN_PLUGIN_MODE will be returned.*/
+ IMONDSPAPI DSPResult IMON_Display_IsPluginModeEnabled();
+
+
+ /**DSPResult IMON_Display_SetVfdText(LPCTSTR lpsz1stLine, LPCTSTR lpsz2ndLine)
+ @brief This function can be used when the caller application wants to display text data on VFD module.\n
+ @param [in] lpsz1stLine This string data will be displayed on the 1st line of VFD module.\n
+ It doesn't support multi-byte character and if string data is longer than 16 characters, it displays 16 characters from the first.\n
+ @param [in] lpsz2ndLine This string data will be displayed on the 2nd line of VFD module.\n
+ It doesn't support multi-byte character and if string data is longer than 16 characters, it displays 16 characters from the first.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_POINTER, DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetVfdText(LPCTSTR lpsz1stLine, LPCTSTR lpsz2ndLine);
+
+ /**DSPResult IMON_Display_SetVfdEqData(PDSPEQDATA pEqData)
+ @brief This function can be used when the caller application wants to display equalizer data on VFD module.\n
+ @param [in] pEqData Pointer of DSPEQDATA structure. The caller application should fill this structure with the equalizer data for 16 bands.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_POINTER, DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetVfdEqData(PDSPEQDATA pEqData);
+
+
+ /**DSPResult IMON_Display_SetLcdText(LPCTSTR lpszText)
+ @brief This function can be used when the caller application wants to display text data on LCD module.\n
+ @param [in] lpszText This string data will be displayed on the LCD module.\n
+ It supports multi-byte character and if string data is longer than display area, it will start to scroll.\n
+ When text scrolling is finished, API will notify it with DSPNotifyCode enumeration value, DSPNM_LCD_TEXT_SCROLL_DONE.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_POINTER, DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdText(LPCTSTR lpszText);
+
+ /**DSPResult IMON_Display_SetLcdEqData(PDSPEQDATA pEqDataL, PDSPEQDATA pEqDataR)
+ @brief This function can be used when the caller application wants to display equalizer data on LCD module.\n
+ @param [in] pEqDataL Pointer of DSPEQDATA structure. This parameter represents equalizer data of left channel.\n
+ The caller application should fill this structure with the equalizer data of left channel for 16 bands.\n
+ @param [in] pEqDataR Pointer of DSPEQDATA structure. This parameter represents equalizer data of right channel.\n
+ The caller application should fill this structure with the equalizer data of right channel for 16 bands.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_POINTER, DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdEqData(PDSPEQDATA pEqDataL, PDSPEQDATA pEqDataR);
+
+
+ /**DSPResult IMON_Display_SetLcdAllIcons(BOOL bOn)
+ @brief This function can be used when the caller application wants to turn on/off all icons on LCD module.\n
+ @param [in] bOn If this value is TRUE, iMON will turn on all icons. Otherwise, iMON will turn off all icons.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdAllIcons(BOOL bOn);
+
+ /**DSPResult IMON_Display_SetLcdOrangeIcon(BYTE btIconData1, BYTE btIconData2)
+ @brief This function can be used when the caller application wants to turn on/off orange shaped disk icons on the upper left part of LCD module.\n
+ Disk icons consist of 8 pieces of orange and orange peel.\n
+ @param [in] btIconData1 Each bit represents one of icons shaped the piece of orange.\n
+ MSB is used for the piece placed on top and the remaining bits are for the piece placed in CCW from top.\n
+ @param [in] btIconData2 MSB represents the orange peel shaped icon. Other bits are not used.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdOrangeIcon(BYTE btIconData1, BYTE btIconData2);
+
+ /**DSPResult IMON_Display_SetLcdMediaTypeIcon(BYTE btIconData)
+ @brief This function can be used when the caller application wants to turn on/off media type icons on the upper part of LCD module.\n
+ @param [in] btIconData Each bit represents one of media type icons. From MSB each bit represents MUSIC, MOVIE, PHOTO, CD/DVD, TV, WEBCASTING and NEWS/WEATHER icon.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdMediaTypeIcon(BYTE btIconData);
+
+ /**DSPResult IMON_Display_SetLcdSpeakerIcon(BYTE btIconData1, BYTE btIconData2)
+ @brief This function can be used when the caller application wants to turn on/off speaker icons on the upper right part of LCD module.\n
+ @param [in] btIconData1 Each bit represents one of speaker icons.\nFrom MSB each bit represents L, C, R, SL, LFE, SR, RL and SPDIF icon.
+ @param [in] btIconData2 MSB represents RR icon. Other bits are not used.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdSpeakerIcon(BYTE btIconData1, BYTE btIconData2);
+
+ /**DSPResult IMON_Display_SetLcdVideoCodecIcon(BYTE btIconData)
+ @brief This function can be used when the caller application wants to turn on/off codec icons for video file on the lower part of LCD module.\n
+ @param [in] btIconData Each bit represents one of video codec icons. From MSB each bit represents MPG, DIVX, XVID, WMV, MPG, AC3, DTS and WMA icon.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdVideoCodecIcon(BYTE btIconData);
+
+ /**DSPResult IMON_Display_SetLcdAudioCodecIcon(BYTE btIconData)
+ @brief This function can be used when the caller application wants to turn on/off codec icons for audio file on the lower part of LCD module.\n
+ @param [in] btIconData Each bit represents one of audio codec icons. From MSB each bit represents MP3, OGG, WMA and WAV icon.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdAudioCodecIcon(BYTE btIconData);
+
+ /**DSPResult IMON_Display_SetLcdAspectRatioIcon(BYTE btIconData)
+ @brief This function can be used when the caller application wants to turn on/off aspect ratio icons on the lower right part of LCD module.\n
+ @param [in] btIconData Each bit represents one of aspect ratio icons. From MSB each bit represents SRC, FIT, TV, HDTV, SCR1 and SCR2 icon.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdAspectRatioIcon(BYTE btIconData);
+
+ /**DSPResult IMON_Display_SetLcdEtcIcon(BYTE btIconData)
+ @brief This function can be used when the caller application wants to turn on/off icons on the lower left part of LCD module.\n
+ @param [in] btIconData Each bit represents icon. From MSB each bit represents REPEAT, SHUFFLE, ALARM, REC, VOL and TIME icon.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdEtcIcon(BYTE btIconData);
+
+ /**DSPResult IMON_Display_SetLcdProgress(int nCurPos, int nTotal)
+ @brief This function can be used when the caller application wants to display progress bar on the upper and lower left part of text area of LCD module.\n
+ @param [in] nCurPos It represents the current position of progress bar.\n
+ @param [in] nTotal It represents the total length of progress bar.\n
+ @return This function will return one of DSPResult enumeration value.\n
+ DSP_SUCCEEDED will be returned if succeeded. DSP_E_NOT_INITED or DSP_E_FAIL can be returned if failed.*/
+ IMONDSPAPI DSPResult IMON_Display_SetLcdProgress(int nCurPos, int nTotal);
+
+#ifdef __cplusplus
+}
+#endif //__cplusplus
+
+#endif //__IMON_DISPLAY_API_H__
\ No newline at end of file
diff -r 000000000000 -r a77691c40066 iMONDisplayDefines.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/iMONDisplayDefines.h Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,114 @@
+#ifndef __IMON_DISPLAY_API_DEFINES_H__
+#define __IMON_DISPLAY_API_DEFINES_H__
+
+//////////////////////////////////////////////////
+//////////////////////////////////////////////////
+// Enumerations
+
+/**DSPResult
+@brief These enumeration values represent the returned result for iMON Display API function calls.\n
+ All iMON Display API function calls return one of this result values.\n
+ For meaning of each result, refer the comment of each line below*/
+enum DSPResult
+{
+ DSP_SUCCEEDED = 0, //// Function Call Succeeded Without Error
+ DSP_E_FAIL, //// Unspecified Failure
+ DSP_E_OUTOFMEMORY, //// Failed to Allocate Necessary Memory
+ DSP_E_INVALIDARG, //// One or More Arguments Are Not Valid
+ DSP_E_NOT_INITED, //// API is Not Initialized
+ DSP_E_POINTER, //// Pointer is Not Valid
+
+ DSP_S_INITED = 0x1000, //// API is Initialized
+ DSP_S_NOT_INITED, //// API is Not Initialized
+ DSP_S_IN_PLUGIN_MODE, //// API Can Control iMON Display (Display Plug-in Mode)
+ DSP_S_NOT_IN_PLUGIN_MODE, //// API Can't Control iMON Display
+};
+
+
+/**DSPNInitResult
+@brief These enumeration values represent the result status for requesting Display Plug-in Mode to iMON.\n
+ iMON Display API notifies one of this result values to the caller application after requesting Display Plug-in Mode to iMON.\n
+ For more information, refer the comment of each line below*/
+enum DSPNInitResult
+{
+ DSPN_SUCCEEDED = 0, //// Display Plug-in Mode is Initialized Successfully
+ DSPN_ERR_IN_USED = 0x0100, //// Display Plug-in is Already Used by Other Application
+ DSPN_ERR_HW_DISCONNECTED, //// iMON HW is Not Connected
+ DSPN_ERR_NOT_SUPPORTED_HW, //// The Connected iMON HW doesn't Support Display Plug-in
+ DSPN_ERR_PLUGIN_DISABLED, //// Display Plug-in Mode Option is Disabled
+ DSPN_ERR_IMON_NO_REPLY, //// The Latest iMON is Not Installed or iMON Not Running
+ DSPN_ERR_UNKNOWN = 0x0200, //// Unknown Failure
+};
+
+
+/**DSPType
+@brief These enumeration values represent display type.\n
+ Currently iMON Display API supports VFD and LCD products.*/
+enum DSPType
+{
+ DSPN_DSP_NONE = 0,
+ DSPN_DSP_VFD = 0x01, //// VFD products
+ DSPN_DSP_LCD = 0x02, //// LCD products
+};
+
+
+/**DSPNotifyCode
+@brief These enumeration values represent the notification codes.\n
+ iMON Display API will send or post message to the caller application.\n
+ The caller application should assign the message and the winodw handle to receivce message with IMON_Display_Init fucntion.\n
+ These enumeration values are used with WPARAM parameter of the message.\n
+ For more information, see the explanation of each notification code below*/
+enum DSPNotifyCode
+{
+ /**DSPNM_PLUGIN_SUCCEED
+ @brief When API succeeds to get the control for the display, API will post caller-specified message with DSPNM_PLUGIN_SUCCEED as WPARAM parameter.\n
+ LPARAM represents DSPType. This value can be 0x01 (VFD), 0x02 (LCD) or 0x03 (VFD+LCD).*/
+ DSPNM_PLUGIN_SUCCEED = 0,
+
+ /**DSPNM_PLUGIN_FAILED
+ @brief When API fails to get the control for the display, API will post caller-specified message with DSPNM_PLUGIN_FAILED as WPARAM parameter.\n
+ LPARAM represents error code with DSPNResult.*/
+ DSPNM_PLUGIN_FAILED,
+
+ /**DSPNM_IMON_RESTARTED
+ @brief When iMON starts, API will post caller-specified message with DSPNM_IMON_RESTARTED as WPARAM parameter.\n
+ LPARAM represents DSPType. This value can be 0 (No Display), 0x01 (VFD), 0x02 (LCD) or 0x03 (VFD+LCD).*/
+ DSPNM_IMON_RESTARTED,
+
+ /**DSPNM_IMON_CLOSED
+ @brief When iMON closed, API will post caller-specified message with DSPNM_IMON_CLOSED as WPARAM parameter.\n
+ LPARAM is not used.*/
+ DSPNM_IMON_CLOSED,
+
+ /**DSPNM_HW_CONNECTED
+ @brief When iMON HW newly connected, API will post caller-specified message with DSPNM_HW_CONNECTED as WPARAM parameter.\n
+ LPARAM represents DSPType. This value can be 0 (No Display), 0x01 (VFD), 0x02 (LCD) or 0x03 (VFD+LCD).*/
+ DSPNM_HW_CONNECTED,
+
+ /**DSPNM_HW_DISCONNECTED
+ @brief When iMON HW disconnected, API will post caller-specified message with DSPNM_HW_DISCONNECTED as WPARAM parameter.\n
+ LPARAM is DSPNResult value, DSPN_ERR_HW_DISCONNECTED.*/
+ DSPNM_HW_DISCONNECTED,
+
+
+ /**DSPNM_LCD_TEXT_SCROLL_DONE
+ @brief When iMON LCD finishes scrolling Text, API will post caller-specified message with DSPNM_LCD_TEXT_SCROLL_DONE as WPARAM parameter.\n
+ The caller application may need to know when text scroll is finished, for sending next text.\n
+ LPARAM is not used.*/
+ DSPNM_LCD_TEXT_SCROLL_DONE = 0x1000,
+};
+
+//////////////////////////////////////////////////
+//////////////////////////////////////////////////
+// Structure
+
+/**DspEqData
+@brief This structure contains Equalizer data for 16 bands.
+@param BandData It represents Equalizer data for 16 bands. Its range is from 0 to 100.*/
+typedef struct DspEqData
+{
+ int BandData[16];
+
+} DSPEQDATA, *PDSPEQDATA;
+
+#endif //__IMON_DISPLAY_API_DEFINES_H__
\ No newline at end of file
diff -r 000000000000 -r a77691c40066 small.ico
Binary file small.ico has changed
diff -r 000000000000 -r a77691c40066 stdafx.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stdafx.cpp Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// SoundGraphAccess.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff -r 000000000000 -r a77691c40066 stdafx.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/stdafx.h Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,21 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include
+
+// C RunTime Header Files
+#include
+#include
+#include
+#include
+
+
+// TODO: reference additional headers your program requires here
diff -r 000000000000 -r a77691c40066 targetver.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/targetver.h Thu Feb 07 01:10:03 2013 +0100
@@ -0,0 +1,24 @@
+#pragma once
+
+// The following macros define the minimum required platform. The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to and
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
+#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
+#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
+#endif