sl@1: // StephaneLenclud@35: // Copyright (C) 2014-2015 Stéphane Lenclud. sl@1: // StephaneLenclud@35: // This file is part of MiniDisplay. StephaneLenclud@35: // StephaneLenclud@35: // MiniDisplay is free software: you can redistribute it and/or modify StephaneLenclud@35: // it under the terms of the GNU General Public License as published by StephaneLenclud@35: // the Free Software Foundation, either version 3 of the License, or StephaneLenclud@35: // (at your option) any later version. StephaneLenclud@35: // StephaneLenclud@35: // MiniDisplay is distributed in the hope that it will be useful, StephaneLenclud@35: // but WITHOUT ANY WARRANTY; without even the implied warranty of StephaneLenclud@35: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the StephaneLenclud@35: // GNU General Public License for more details. StephaneLenclud@35: // StephaneLenclud@35: // You should have received a copy of the GNU General Public License StephaneLenclud@35: // along with MiniDisplay. If not, see . sl@1: // sl@1: sl@1: #ifndef MINI_DISPLAY_H sl@1: #define MINI_DISPLAY_H sl@1: sl@2: /* Cmake will define MyLibrary_EXPORTS on Windows when it sl@2: configures to build a shared library. If you are going to use sl@2: another build system on windows or create the visual studio sl@2: projects by hand you need to define MyLibrary_EXPORTS when sl@2: building a DLL on windows. sl@1: */ sl@2: // We are using the Visual Studio Compiler and building Shared libraries sl@1: sl@4: #if defined (_WIN32) sl@2: #if defined(MiniDisplay_EXPORTS) sl@2: #define MDAPI __declspec(dllexport) sl@2: #else sl@2: #define MDAPI __declspec(dllimport) sl@2: #endif /* MyLibrary_EXPORTS */ sl@2: #else /* defined (_WIN32) */ sl@2: #define MDAPI sl@2: #endif sl@2: sl@2: typedef void* MiniDisplayDevice; sl@2: sl@4: typedef enum sl@4: { StephaneLenclud@24: EMiniDisplayAutoDetect=0, sl@8: EMiniDisplayFutabaGP1212A01, StephaneLenclud@18: EMiniDisplayFutabaGP1212A02, StephaneLenclud@25: EMiniDisplayFutabaMDM166AA, StephaneLenclud@18: EMiniDisplayAutoDetectFailed sl@8: } sl@8: TMiniDisplayType; sl@8: sl@8: typedef enum sl@8: { StephaneLenclud@32: EMiniDisplayRequestNone=0, sl@4: EMiniDisplayRequestDeviceId, sl@4: EMiniDisplayRequestFirmwareRevision, sl@4: EMiniDisplayRequestPowerSupplyStatus sl@4: } sl@4: TMiniDisplayRequest; sl@4: StephaneLenclud@24: /** StephaneLenclud@32: Define the various type of icons we support. StephaneLenclud@32: For binary compatibility new entries must be added at the end. StephaneLenclud@32: */ StephaneLenclud@32: typedef enum StephaneLenclud@32: { StephaneLenclud@33: EMiniDisplayIconNetworkSignal=0, StephaneLenclud@33: EMiniDisplayIconInternet, StephaneLenclud@32: EMiniDisplayIconEmail, StephaneLenclud@32: EMiniDisplayIconMute, StephaneLenclud@32: EMiniDisplayIconVolume, StephaneLenclud@32: EMiniDisplayIconVolumeLabel, StephaneLenclud@32: EMiniDisplayIconPlay, StephaneLenclud@32: EMiniDisplayIconPause, StephaneLenclud@32: EMiniDisplayIconRecording StephaneLenclud@32: } StephaneLenclud@32: TMiniDisplayIconType; StephaneLenclud@32: StephaneLenclud@32: /** StephaneLenclud@24: Attempt to establish a connection to with a display of the given type. StephaneLenclud@24: Supports display auto-detection too. StephaneLenclud@24: StephaneLenclud@24: @param [IN] The display type we want to connect to. StephaneLenclud@24: @return Handle to the device we connected to on success, null otherwise. StephaneLenclud@24: */ sl@8: extern "C" MDAPI MiniDisplayDevice MiniDisplayOpen(TMiniDisplayType aType); StephaneLenclud@24: StephaneLenclud@24: /** StephaneLenclud@24: Close the connection with the given display device. StephaneLenclud@24: StephaneLenclud@24: @param [IN] The device to apply this command to. StephaneLenclud@24: */ sl@2: extern "C" MDAPI void MiniDisplayClose(MiniDisplayDevice aDevice); sl@1: sl@1: /** StephaneLenclud@24: Provides the number of display types supported. StephaneLenclud@24: That includes the pseudo 'Auto-Detect' display. StephaneLenclud@24: @return The number of display type supported. StephaneLenclud@24: */ StephaneLenclud@24: extern "C" MDAPI int MiniDisplayTypeCount(); StephaneLenclud@24: StephaneLenclud@24: /** StephaneLenclud@24: Provides the human readable name of the given display type. StephaneLenclud@24: StephaneLenclud@24: @param [IN] The display type we want to get the name for. StephaneLenclud@24: @return The name of the given display type. StephaneLenclud@24: */ StephaneLenclud@24: extern "C" MDAPI wchar_t* MiniDisplayTypeName(TMiniDisplayType aType); StephaneLenclud@24: StephaneLenclud@24: /** sl@2: Clear our MiniDisplay. sl@2: @param [IN] The device to apply this command to. sl@1: */ sl@2: extern "C" MDAPI void MiniDisplayClear(MiniDisplayDevice aDevice); sl@1: sl@2: /** sl@2: Fill our MiniDisplay. sl@2: @param [IN] The device to apply this command to. sl@2: */ sl@2: extern "C" MDAPI void MiniDisplayFill(MiniDisplayDevice aDevice); sl@1: sl@2: /** sl@2: Swap our MiniDisplay buffers committing our back buffer content to the screen. sl@2: @param [IN] The device to apply this command to. sl@2: */ sl@2: extern "C" MDAPI void MiniDisplaySwapBuffers(MiniDisplayDevice aDevice); sl@2: sl@2: /** sl@2: Provide maximum brightness level for the given device. sl@2: @param [IN] The device to apply this command to. sl@2: @return Maximum brightness level. sl@2: */ sl@2: extern "C" MDAPI int MiniDisplayMaxBrightness(MiniDisplayDevice aDevice); sl@2: sl@2: /** sl@2: Provide minimum brightness level for the given device. sl@2: @param [IN] The device to apply this command to. sl@2: @return Minimum brightness level. sl@2: */ sl@2: extern "C" MDAPI int MiniDisplayMinBrightness(MiniDisplayDevice aDevice); sl@2: sl@2: /** sl@2: Set device brightness level. sl@2: @param [IN] The device to apply this command to. sl@2: @param [IN] Brightness level sl@2: */ sl@2: extern "C" MDAPI void MiniDisplaySetBrightness(MiniDisplayDevice aDevice, int aBrightness); sl@1: sl@3: /** sl@3: Provide pixels width of our display. sl@3: @param [IN] The device to apply this command to. sl@3: @return Width in pixels. sl@3: */ sl@3: extern "C" MDAPI int MiniDisplayWidthInPixels(MiniDisplayDevice aDevice); sl@3: sl@3: /** sl@3: Provide pixels height of our display. sl@3: @param [IN] The device to apply this command to. sl@3: @return Height in pixels. sl@3: */ sl@3: extern "C" MDAPI int MiniDisplayHeightInPixels(MiniDisplayDevice aDevice); sl@3: sl@3: /** sl@3: Set our given pixel. sl@3: @param [IN] The device to apply this command to. sl@3: @param [IN] Pixel X coordinate. sl@3: @param [IN] Pixel Y coordinate. sl@3: @param [IN] Pixel value. sl@3: */ sl@22: extern "C" MDAPI void MiniDisplaySetPixel(MiniDisplayDevice aDevice, int aX, int aY, unsigned int aPixel); sl@3: sl@3: //TODO: Have an API to specify pixel depth sl@3: sl@4: /** sl@4: Provide vendor name. sl@4: @param [IN] The device to apply this command to. sl@4: @return Vendor name. sl@4: */ sl@4: extern "C" MDAPI wchar_t* MiniDisplayVendor(MiniDisplayDevice aDevice); sl@4: sl@4: /** sl@4: Provide product name. sl@4: @param [IN] The device to apply this command to. sl@4: @return Product name. sl@4: */ sl@4: extern "C" MDAPI wchar_t* MiniDisplayProduct(MiniDisplayDevice aDevice); sl@4: sl@4: /** sl@4: Provide Serial number. sl@4: @param [IN] The device to apply this command to. sl@4: @return Serial number name. sl@4: */ sl@4: extern "C" MDAPI wchar_t* MiniDisplaySerialNumber(MiniDisplayDevice aDevice); sl@4: sl@4: /** sl@4: Request device ID. sl@4: @param [IN] The device to apply this command to. sl@4: */ sl@11: extern "C" MDAPI void MiniDisplayRequest(MiniDisplayDevice aDevice, TMiniDisplayRequest aRequest); sl@4: sl@4: /** sl@4: Tell whether or not a request is pending. sl@4: @param [IN] The device to apply this command to. sl@4: @return true if we have a request pending, false otherwise. sl@4: */ sl@4: extern "C" MDAPI bool MiniDisplayRequestPending(MiniDisplayDevice aDevice); sl@4: sl@4: sl@4: /** sl@4: Provide the current request if any. sl@4: @param [IN] The device to apply this command to. sl@4: @return The current request if any. sl@4: */ sl@4: extern "C" MDAPI TMiniDisplayRequest MiniDisplayCurrentRequest(MiniDisplayDevice aDevice); sl@4: sl@4: sl@4: /** sl@4: Cancel any pending request. sl@4: @param [IN] The device to apply this command to. sl@4: */ sl@4: extern "C" MDAPI void MiniDisplayCancelRequest(MiniDisplayDevice aDevice); sl@1: sl@5: /** sl@5: Attempt request completion. sl@5: @param [IN] The device to apply this command to. sl@5: */ sl@6: extern "C" MDAPI TMiniDisplayRequest MiniDisplayAttemptRequestCompletion(MiniDisplayDevice aDevice); sl@5: sl@5: /** sl@5: Provide device ID. sl@5: @param [IN] The device to apply this command to. sl@5: @return Device ID name. sl@5: */ sl@5: extern "C" MDAPI char* MiniDisplayDeviceId(MiniDisplayDevice aDevice); sl@5: sl@5: /** sl@5: Provide firmware revision. sl@5: @param [IN] The device to apply this command to. sl@5: @return Firmware revision name. sl@5: */ sl@5: extern "C" MDAPI char* MiniDisplayFirmwareRevision(MiniDisplayDevice aDevice); sl@5: sl@6: /** sl@6: Get power supply status. sl@6: @param [IN] The device to apply this command to. sl@6: */ sl@6: extern "C" MDAPI bool MiniDisplayPowerSupplyStatus(MiniDisplayDevice aDevice); sl@6: sl@16: /** sl@16: Turn device Power ON. sl@16: @param [IN] The device to apply this command to. sl@16: */ sl@16: extern "C" MDAPI void MiniDisplayPowerOn(MiniDisplayDevice aDevice); sl@16: sl@16: /** sl@16: Turn device Power OFF. sl@16: @param [IN] The device to apply this command to. sl@16: */ sl@16: extern "C" MDAPI void MiniDisplayPowerOff(MiniDisplayDevice aDevice); sl@16: sl@16: /** sl@16: Specifies whether or not this display supports power ON/OFF functions. sl@16: @param [IN] The device to apply this command to. sl@16: @return True if one can turn display power on and off, false otherwise. sl@16: */ sl@16: extern "C" MDAPI bool MiniDisplaySupportPowerOnOff(MiniDisplayDevice aDevice); sl@6: sl@17: /** sl@17: Show built-in clock. sl@17: @param [IN] The device to apply this command to. sl@17: */ sl@17: extern "C" MDAPI void MiniDisplayShowClock(MiniDisplayDevice aDevice); sl@17: sl@17: /** sl@17: Hide built-in clock. sl@17: @param [IN] The device to apply this command to. sl@17: */ sl@17: extern "C" MDAPI void MiniDisplayHideClock(MiniDisplayDevice aDevice); sl@17: sl@17: /** sl@17: Specifies whether or not this display supports clock functions. sl@17: @param [IN] The device to apply this command to. sl@17: @return True if this display supports built-in clock, false otherwise. sl@17: */ sl@17: extern "C" MDAPI bool MiniDisplaySupportClock(MiniDisplayDevice aDevice); sl@17: StephaneLenclud@32: /** StephaneLenclud@32: Tells how many icons of the given are supported by the specified device. StephaneLenclud@32: Typically icons on a VFD hardware have several segments that can be light up separately. StephaneLenclud@32: @param [IN] The device to apply this command to. StephaneLenclud@32: @param [IN] The type of icon we are interested in. StephaneLenclud@32: @return The number of icons of this kind this display supports. StephaneLenclud@32: */ StephaneLenclud@32: extern "C" MDAPI int MiniDisplayIconCount(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon); sl@5: StephaneLenclud@32: /** StephaneLenclud@32: Tells how many status the icon of the specified type supports for the given device. StephaneLenclud@32: Status are typically brightness level on VFD hardware. StephaneLenclud@32: Most icon will just support 2 status: 0 for Off and 1 for On. StephaneLenclud@32: @param [IN] The device to apply this command to. StephaneLenclud@32: @param [IN] The type of icon we are interested in. StephaneLenclud@32: @return The number of icons of this kind this display supports. StephaneLenclud@32: */ StephaneLenclud@32: extern "C" MDAPI int MiniDisplayIconStatusCount(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon); StephaneLenclud@32: StephaneLenclud@32: /** StephaneLenclud@32: Set the status of the given icon for the specified device. StephaneLenclud@32: @param [IN] The device to apply this command to. StephaneLenclud@32: @param [IN] The type of icon we are interested in. StephaneLenclud@32: @param [IN] The index of the icon of the given type. StephaneLenclud@32: @param [IN] The status the icon is to assume. StephaneLenclud@32: */ StephaneLenclud@32: extern "C" MDAPI void MiniDisplaySetIconStatus(MiniDisplayDevice aDevice, TMiniDisplayIconType aIcon, int aIndex, int aStatus); StephaneLenclud@31: StephaneLenclud@31: sl@1: #endif sl@1: