Mobile SDK for Windows Apps2.0
Transforming Windows apps into Mobile apps
CitrixMobility.h
Go to the documentation of this file.
00001 
00011 #pragma once
00012 
00013 // pragma align the structures properly in IDL/Typelib
00014 [idl_quote("#pragma pack(1)")];
00015 
00016 
00017 // CMPCOM flag turns on all the IDL generation
00018 #define CMPCOM
00019 
00020 #include "Capability.h"
00021 #include "Session.h"
00022 #include "Channel.h"
00023 #include "Display.h"
00024 #include "Keyboard.h"
00025 #include "Events.h"
00026 #include "Camera.h"
00027 #include "Phone.h"
00028 #include "Message.h"
00029 #include "Picker.h"
00030 #include "Buttons.h"
00031 #include "Control.h"
00032 #include "Device.h"
00033 #include "Notification.h"
00034 #include "Dispatch.h"
00035 #include "virtualdevice.h"
00036 #include "capture.h"
00037 #include "critsec.h"
00038 
00039 #include <cmpabstract.h>
00040 
00041 //
00042 // the custom attribute controls the namespace
00043 //
00044 [
00045    coclass,
00046    threading(both),
00047    default(ICMPDispatch),
00048    vi_progid("Citrix.Mobility"),
00049    progid("Citrix.Mobility.1"),
00050    version(1.0),
00051    uuid("10A7B690-BCAC-4A29-9BB1-6E4D13AFF25B"),
00052    helpstring("Citrix Mobility COM Class"),
00053    event_source(com)
00054 ]
00055 class CitrixMobile: 
00056     public IButton,
00057     public ICamera,
00058     public ICapabilities,
00059     public IChannel,
00060     public ICMPDevice,
00061     public ICMPDispatch,
00062     public IControl,
00063     public IDisplay,
00064     public IEventFilter,
00065     public IEventSource,
00066     public IKeyboard,
00067     public IMessage,
00068     public INotification,
00069     public IPhone,
00070     public IPicker,
00071     public ISession,
00072     public IVirtualDevice,
00073     public ICMPCapture,
00074     public IOrientation
00075 {
00076 
00077 public:
00078     __event __interface ICMPEvents;
00079 
00080     CitrixMobile();
00081 
00082     //DECLARE_PROTECT_FINAL_CONSTRUCT()
00083     HRESULT FinalConstruct();
00084 
00085     void FinalRelease();
00086 
00087     // ISession
00088     STDMETHODIMP IsSessionActive(VARIANT_BOOL* sessionActive);
00089     STDMETHODIMP GetSessionState(CMP_SESSION_STATE* sessionState);
00090     STDMETHODIMP OpenSession(CMPRESULT* result);
00091     STDMETHODIMP CloseSession(CMPRESULT* result);
00092     STDMETHODIMP GetErrorText(CMP_ERROR_ID errorId, BSTR *errorText, CMPRESULT* result);
00093     STDMETHODIMP SetSessionOptionBool(CMP_SESSION_OPTION option, VARIANT_BOOL value, CMPRESULT* rc);
00094     STDMETHODIMP GetSessionOptionBool(CMP_SESSION_OPTION option, VARIANT_BOOL *value, CMPRESULT* rc);
00095     STDMETHODIMP RegisterCMPProcess(DWORD processId, CMPRESULT* rc);
00096     STDMETHODIMP UnregisterCMPProcess(DWORD processId, CMPRESULT* rc);
00097     STDMETHODIMP DetectCMPProcess(DWORD processId, VARIANT_BOOL *value, CMPRESULT* rc);
00098 
00099     // IChannel
00100     STDMETHODIMP IsChannelOpen(VARIANT_BOOL *channelStarted);
00101     STDMETHODIMP OpenChannel(CMP_CHANNEL_FLAGS channelFlags, CMPRESULT* result);
00102     STDMETHODIMP CloseChannel(CMPRESULT* result);
00103     STDMETHODIMP GetChannelState(CMP_CHANNEL_STATE *state);
00104 
00105     //ICapabilities
00106     STDMETHODIMP GetCapabilityBool(CMP_CAP_ID capId, CMP_KEY_ID keyId, VARIANT_BOOL *keyValue, CMPRESULT* result);
00107     STDMETHODIMP GetCapabilityInt16(CMP_CAP_ID capId, CMP_KEY_ID keyId, INT16 *keyValue, CMPRESULT* result);
00108     STDMETHODIMP GetCapabilityUInt16(CMP_CAP_ID capId, CMP_KEY_ID keyId, PUINT16 value, CMPRESULT* result);
00109     STDMETHODIMP GetCapabilityInt32(CMP_CAP_ID capId, CMP_KEY_ID keyId, PINT32 keyValue, CMPRESULT* result);
00110     STDMETHODIMP GetCapabilityUInt32(CMP_CAP_ID capId, CMP_KEY_ID keyId, PUINT32 keyValue, CMPRESULT* result);
00111 
00112     //IEventSource
00113     STDMETHODIMP FireSessionStateChangedEvent(CMP_SESSION_STATE state);
00114     STDMETHODIMP FireChannelStateChangedEvent(CMP_CHANNEL_STATE state);
00115     STDMETHODIMP FireOrientationChangedEvent(CMPRESULT rc, CMP_ORIENTATION_DATA *orientationData);
00116     STDMETHODIMP FirePictureTakenEvent(CMPRESULT rc, CMP_UNIQUE_ID imageID, CMP_IMAGE_FORMAT pictType, INT32 pictureSize, BSTR filename);
00117     STDMETHODIMP FireSMSStartedEvent(CMPRESULT rc, CMP_UNIQUE_ID msgID);
00118     STDMETHODIMP FireButtonPressedEvent(CMP_BUTTON_ID button);
00119 
00120     STDMETHODIMP FireDisplaySettingsChangedEvent(CMP_DISPLAY_SETTINGS *displayMetrics);
00121     STDMETHODIMP FireScrollModeChangedEvent(CMPRESULT rc, CMP_SCROLL_MODE scrollMode);
00122     STDMETHODIMP FireKeyboardStateChangedEvent(CMPRESULT rc, CMP_KEYBOARD_STATE* keyboardState);
00123     STDMETHODIMP FireViewportOriginChangedEvent(CMPRESULT rc, CMP_DISPLAY_POINT* point);
00124     STDMETHODIMP FireButtonTargetChangedEvent(CMPRESULT rc, CMP_BUTTON_ID button, CMP_BUTTON_TARGET buttonTarget);
00125     STDMETHODIMP FireControlStateChangedEvent(CMPRESULT rc, INT16 controlState);
00126     STDMETHODIMP FirePhoneCallStartedEvent(CMPRESULT rc, CMP_UNIQUE_ID callId);
00127     STDMETHODIMP FireUserNotifiedEvent(CMPRESULT rc, CMP_UNIQUE_ID notificationId);
00128     STDMETHODIMP FireCameraPictureRemovedEvent(CMPRESULT rc, CMP_UNIQUE_ID pictureId);
00129     STDMETHODIMP FireEventFilterChangedEvent(CMPRESULT rc, CMP_EVENT_ID eventId, INT16 filterFlags);
00130     STDMETHODIMP FirePickerControlStateChangedEvent(CMP_UNIQUE_ID controlId, INT16 pickerFlags, CMPRESULT result, INT16 selectedItemIndex);
00131     STDMETHODIMP FireViewportChangedEvent(CMPRESULT rc, INT16 flags, INT16 zoomFactor, CMP_DISPLAY_RECT* serverViewport, CMP_DISPLAY_RECT* clientViewport);
00132 
00133     STDMETHODIMP FirePictureCaptured(CMPRESULT rc, CMP_UNIQUE_LONG_ID uniqueId, BSTR pictureMetadata, BSTR filename, BSTR thumbnail, UINT32 pictureSize, CMP_CAPTURE_PICTURE_OPTIONS *options);
00134     STDMETHODIMP FireVideoCaptured(CMPRESULT rc, CMP_UNIQUE_LONG_ID uniqueId, BSTR videoMetadata, BSTR filename, UINT32 videoSize, CMP_CAPTURE_VIDEO_OPTIONS *options);
00135     STDMETHODIMP FireAudioCaptured(CMPRESULT rc, CMP_UNIQUE_LONG_ID uniqueId, BSTR audioMetadata, BSTR filename, UINT32 audioSize, CMP_CAPTURE_AUDIO_OPTIONS *options);
00136 
00137     STDMETHODIMP FireAppForeground();
00138     STDMETHODIMP FireAppBackground();
00139     STDMETHODIMP FireForegroundAppChanged(DWORD foregroundProcessId);
00140 
00141     STDMETHODIMP FireSupportedOrientationsChanged(CMPRESULT rc, CMP_SUPPORTED_ORIENTATIONS supportedOrientations);
00142     STDMETHODIMP FireCaptureMediaRemoved(CMPRESULT rc, CMP_UNIQUE_LONG_ID captureId);
00143 
00144     //IKeyboard
00145     STDMETHODIMP HideKeyboard(CMPRESULT* result);
00146     STDMETHODIMP ShowKeyboard(CMP_KEYBOARD_STATE *kybdState, CMPRESULT* result);
00147     STDMETHODIMP GetKeyboardState(CMP_KEYBOARD_STATE *kybdState, CMPRESULT* result);
00148     
00149     //IDisplay
00150     STDMETHODIMP GetOrientation(CMP_ORIENTATION_DATA *orientationData, CMPRESULT* result);
00151     STDMETHODIMP SetOrientation(CMP_ORIENTATION_POSITION orientation, INT16 orientationFlags, CMPRESULT* result);
00152     STDMETHODIMP GetScrollMode(CMP_SCROLL_MODE *scrollMode, CMPRESULT* result);
00153     STDMETHODIMP SetScrollMode(CMP_SCROLL_MODE scrollMode, CMPRESULT* result);
00154     STDMETHODIMP SetViewportOrigin(CMP_DISPLAY_POINT *pt, INT16 viewportFlags, CMPRESULT* result);
00155     STDMETHODIMP GetViewportOrigin(CMP_DISPLAY_POINT *pt, CMPRESULT* result);
00156     STDMETHODIMP GetDisplaySettings(CMP_DISPLAY_SETTINGS *dispSettings, CMPRESULT* result);
00157     STDMETHODIMP SetViewport(INT16 flags, INT16 zoomFactor, CMP_DISPLAY_RECT* serverViewport, CMPRESULT* result);
00158     STDMETHODIMP GetViewport(INT16* flags, INT16* zoomFactor, CMP_DISPLAY_RECT* serverViewport, 
00159                              CMP_DISPLAY_RECT* clientViewport, CMPRESULT* result);
00160 
00161     //ICamera
00162     STDMETHODIMP TakePicture(CMP_IMAGE_FORMAT imgType, CMP_UNIQUE_ID imageID, CMPRESULT* result);
00163     STDMETHODIMP GetPictureFilename(CMP_UNIQUE_ID pictureId, BSTR* filename, CMPRESULT* result);
00164     STDMETHODIMP GetPictureState(CMP_UNIQUE_ID pictureId, PINT32 size, CMP_PICTURE_STATE *pictState, CMPRESULT* result);
00165     STDMETHODIMP RemovePicture(CMP_UNIQUE_ID pictureId, CMPRESULT* result);
00166 
00167     //IPhone
00168     STDMETHODIMP StartPhoneCall(BSTR phoneNumber, CMP_UNIQUE_ID phoneCallId, CMPRESULT* result);
00169 
00170     //IMessage
00171     STDMETHODIMP SendSMS(BSTR phoneNumber, CMP_UNIQUE_ID messageId, BSTR SMSText, CMPRESULT* result);
00172 
00173 
00174     //IPicker
00175     STDMETHODIMP HidePicker(CMP_UNIQUE_ID controlID, CMPRESULT* result);
00176     STDMETHODIMP ShowPicker(CMP_UNIQUE_ID controlID, CMP_DISPLAY_RECT *rect, INT32 selectedIndex, 
00177                             BSTR listItems, BSTR title, CMPRESULT* result);
00178 
00179     STDMETHODIMP ShowPicker(CMP_UNIQUE_ID controlID, CMP_DISPLAY_RECT *rect, INT32 selectedIndex, 
00180                             SAFEARRAY **pickerText, BSTR pickerTitle, CMPRESULT* result);
00181 
00182     //IButton
00183     STDMETHODIMP SetButtonTarget(CMP_BUTTON_ID button, CMP_BUTTON_TARGET target, CMPRESULT* result);
00184     STDMETHODIMP GetButtonTarget(CMP_BUTTON_ID button, CMP_BUTTON_TARGET *target, CMPRESULT* result);
00185 
00186     STDMETHODIMP GetPickerState(CMP_UNIQUE_ID controlId, PINT16 pickerState, CMPRESULT* result);
00187 
00188 
00189     //IControl
00190     STDMETHODIMP EnableControls(CMPRESULT* result);
00191     STDMETHODIMP DisableControls(CMPRESULT* result);
00192     STDMETHODIMP GetControlsFlags(PINT16 controlFlags, CMPRESULT* result);
00193 
00194     //ICMPDevice
00195     STDMETHODIMP GetDevicePropertyBool(CMP_DEV_BOOL_PROP_ID propertyId, VARIANT_BOOL *value, CMPRESULT* result);
00196     STDMETHODIMP GetDevicePropertyString(CMP_DEV_STRING_PROP_ID propertyId, BSTR *string, CMPRESULT* result);
00197 
00198     //IEventFilter
00199     STDMETHODIMP FilterEvent(CMP_EVENT_ID eventId, INT16 filterFlags, CMPRESULT* result);
00200 
00201     //INotification
00202     STDMETHODIMP NotifyUser(CMP_UNIQUE_ID notificationId, INT16 notificationFlags, BSTR notificationText, CMPRESULT* result);
00203 
00204     //IVirtualDevice
00205     STDMETHODIMP OpenSessionForProcess(DWORD processId, CMPRESULT* result);
00206 
00207     //ICMPCapture
00208     STDMETHODIMP CapturePicture(CMP_CAPTURE_PICTURE_OPTIONS *options, CMP_UNIQUE_LONG_ID *uniqueId, CMPRESULT* result);
00209     STDMETHODIMP CaptureVideo(CMP_CAPTURE_VIDEO_OPTIONS *options, CMP_UNIQUE_LONG_ID *uniqueId, CMPRESULT* result);
00210     STDMETHODIMP CaptureAudio(CMP_CAPTURE_AUDIO_OPTIONS *options, CMP_UNIQUE_LONG_ID *uniqueId, CMPRESULT* result);
00211     STDMETHODIMP RemoveCapturedData(CMP_UNIQUE_LONG_ID uniqueId, CMPRESULT* result);
00212 
00213     //IOrientation
00214     STDMETHODIMP SetSupportedOrientations(CMP_SUPPORTED_ORIENTATIONS supportedOrientations, CMPRESULT* result);
00215     STDMETHODIMP GetSupportedOrientations(CMP_SUPPORTED_ORIENTATIONS *supportedOrientations, CMPRESULT* result);
00216 
00217 private:
00218     STDMETHODIMP ConnectToSession(CMPRESULT* rc);
00219 
00220     ICMPAPI * _session;
00221     CritSec _sessionCS;
00222     bool _sessionactive;
00223     CMP_SESSION_STATE _sessionState;
00224     CMP_CHANNEL_STATE _channelState;
00225     CMPEvents* _eventHandler;
00226     HMODULE _hModVDO;
00227 };
00228 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Events Defines