From: DotnetBuild Date: Mon, 11 Sep 2017 15:00:27 +0000 (+0900) Subject: Release 4.0.0-preview1-00183 X-Git-Tag: accepted/tizen/4.0/unified/20170912.184311~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24a95da97fe83252ca14ca6aa7276203203c0675;hp=12c9ab8b3191a614dc9006b57c1cba6e1f3b6d13;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Release 4.0.0-preview1-00183 --- diff --git a/Artifacts/Tizen.NET.4.0.0-preview1-00175.nupkg b/Artifacts/Tizen.NET.4.0.0-preview1-00183.nupkg similarity index 90% rename from Artifacts/Tizen.NET.4.0.0-preview1-00175.nupkg rename to Artifacts/Tizen.NET.4.0.0-preview1-00183.nupkg index 830479c..cb1a2ff 100644 Binary files a/Artifacts/Tizen.NET.4.0.0-preview1-00175.nupkg and b/Artifacts/Tizen.NET.4.0.0-preview1-00183.nupkg differ diff --git a/Artifacts/Tizen.NET.4.0.0-preview1-00175.symbols.nupkg b/Artifacts/Tizen.NET.4.0.0-preview1-00183.symbols.nupkg similarity index 89% rename from Artifacts/Tizen.NET.4.0.0-preview1-00175.symbols.nupkg rename to Artifacts/Tizen.NET.4.0.0-preview1-00183.symbols.nupkg index 979d554..a14c4e1 100644 Binary files a/Artifacts/Tizen.NET.4.0.0-preview1-00175.symbols.nupkg and b/Artifacts/Tizen.NET.4.0.0-preview1-00183.symbols.nupkg differ diff --git a/Artifacts/Tizen.NET.Private.4.0.0-preview1-00175.nupkg b/Artifacts/Tizen.NET.Private.4.0.0-preview1-00183.nupkg similarity index 90% rename from Artifacts/Tizen.NET.Private.4.0.0-preview1-00175.nupkg rename to Artifacts/Tizen.NET.Private.4.0.0-preview1-00183.nupkg index 76aad08..3d8a337 100644 Binary files a/Artifacts/Tizen.NET.Private.4.0.0-preview1-00175.nupkg and b/Artifacts/Tizen.NET.Private.4.0.0-preview1-00183.nupkg differ diff --git a/Artifacts/Tizen.NET.Private.4.0.0-preview1-00175.symbols.nupkg b/Artifacts/Tizen.NET.Private.4.0.0-preview1-00183.symbols.nupkg similarity index 89% rename from Artifacts/Tizen.NET.Private.4.0.0-preview1-00175.symbols.nupkg rename to Artifacts/Tizen.NET.Private.4.0.0-preview1-00183.symbols.nupkg index 23464b2..07a8778 100644 Binary files a/Artifacts/Tizen.NET.Private.4.0.0-preview1-00175.symbols.nupkg and b/Artifacts/Tizen.NET.Private.4.0.0-preview1-00183.symbols.nupkg differ diff --git a/Artifacts/Version.txt b/Artifacts/Version.txt index d1f9cc2..d751a26 100644 --- a/Artifacts/Version.txt +++ b/Artifacts/Version.txt @@ -1,4 +1,4 @@ Prefix:4.0.0 -Suffix:preview1-00175 -Number:175 -VCS:2fa635d2fb52a3da978cdb98cb3a1d6ef956ff91 +Suffix:preview1-00183 +Number:183 +VCS:a56b675e791c491b1a1f50dcc0c36a779a82ebc8 diff --git a/Artifacts/bin/dummy/Tizen.Multimedia.StreamRecorder.dll b/Artifacts/bin/dummy/Tizen.Multimedia.StreamRecorder.dll index a4a0b46..20c7172 100644 Binary files a/Artifacts/bin/dummy/Tizen.Multimedia.StreamRecorder.dll and b/Artifacts/bin/dummy/Tizen.Multimedia.StreamRecorder.dll differ diff --git a/Artifacts/bin/dummy/Tizen.NUI.dll b/Artifacts/bin/dummy/Tizen.NUI.dll index 1ae42c9..94a50a0 100644 Binary files a/Artifacts/bin/dummy/Tizen.NUI.dll and b/Artifacts/bin/dummy/Tizen.NUI.dll differ diff --git a/Artifacts/bin/dummy/Tizen.Pims.Contacts.dll b/Artifacts/bin/dummy/Tizen.Pims.Contacts.dll index 276ebab..e9abb4a 100644 Binary files a/Artifacts/bin/dummy/Tizen.Pims.Contacts.dll and b/Artifacts/bin/dummy/Tizen.Pims.Contacts.dll differ diff --git a/Artifacts/bin/public/Tizen.Applications.PackageManager.dll b/Artifacts/bin/public/Tizen.Applications.PackageManager.dll index 0d156f1..0e22c0c 100644 Binary files a/Artifacts/bin/public/Tizen.Applications.PackageManager.dll and b/Artifacts/bin/public/Tizen.Applications.PackageManager.dll differ diff --git a/Artifacts/bin/public/Tizen.Applications.PackageManager.pdb b/Artifacts/bin/public/Tizen.Applications.PackageManager.pdb index 702467a..00023bb 100644 Binary files a/Artifacts/bin/public/Tizen.Applications.PackageManager.pdb and b/Artifacts/bin/public/Tizen.Applications.PackageManager.pdb differ diff --git a/Artifacts/bin/public/Tizen.Content.MediaContent.dll b/Artifacts/bin/public/Tizen.Content.MediaContent.dll index e01303c..fb62a96 100644 Binary files a/Artifacts/bin/public/Tizen.Content.MediaContent.dll and b/Artifacts/bin/public/Tizen.Content.MediaContent.dll differ diff --git a/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.dll b/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.dll index b29ddf1..4ca4faf 100644 Binary files a/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.dll and b/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.dll differ diff --git a/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.pdb b/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.pdb index 8625364..dcf14e3 100644 Binary files a/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.pdb and b/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.pdb differ diff --git a/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.xml b/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.xml index ef7c369..b76e3df 100644 --- a/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.xml +++ b/Artifacts/bin/public/Tizen.Multimedia.StreamRecorder.xml @@ -6,349 +6,322 @@ - Provides methods to control stream recorder. - - - StreamRecorder class provides functions to record raw image frame - also provides recording start, stop and save the content etc. - - - - - Occurred when recording is progressing for recording status. + Provides the ability to record user buffer from application. + - + - Occurred when recording time or size reach limit. + Gets the file formats that the current device supports. + An IEnumerable of representing the supported file formats. - + - Occurred when streamrecorder complete to use pushed buffer. + Gets the audio codecs that the current device supports. + An IEnumerable of representing the supported audio codecs. - + - Occurred when streamrecorder state is changed. + Gets the video codecs that the current device supports. + An IEnumerable of representing the supported video codecs. - + - Occurred when error is occured. + Gets the video resolutions that the current device supports. + An IEnumerable of representing the supported resolutions. - Stream recorder constructor. + Initialize a new instance of the class. + The feature is not supported. - + - Stream recorder destructor. + Gets the current state of the stream recorder. + The has already been disposed. - - - Event that occurs when streamrecorder state is changed. - - - + - Event that occurs when buffer had comsumed completely. + Prepares the stream recorder with the specified options. + The recorder must be . + The options for recording. + The recorder is not in the valid state. + Both and + are null. + + contains a value which is not supported. + The has already been disposed. + + + + + - + - Event that occurs when recording status changed. + Unprepares the stream recorder. + + The recorder state must be state by + , and .\n + The recorder state will be .\n + \n + It has no effect if the recorder is already in the state. + + The recorder is not in the valid state. + The has already been disposed. + - + - Event that occurs when recording limit is reached. + Starts recording. + + The recorder state must be state by + or + state by .\n + \n + It has no effect if the recorder is already in the state. + + The recorder is not in the valid state. + The access of the resources can not be granted. + The has already been disposed. + + + - + - Event that occurs when an error occured during recorder operation. + Pauses recording. + + Recording can be resumed with .\n + \n + The recorder state must be state by \n + \n + It has no effect if the recorder is already in the state. + + The recorder is not in the valid state. + The has already been disposed. + + + - + - The file path to record. + Stops recording and saves the result. - If the same file already exists in the file system, then old file - will be overwritten. + The recorder state must be state by or + state by .\n + \n + The recorder state will be after commit.\n + + http://tizen.org/privilege/mediastorage is needed if the save path are relevant to media storage. + http://tizen.org/privilege/externalstorage is needed if the save path are relevant to external storage. + + http://tizen.org/privilege/mediastorage + http://tizen.org/privilege/externalstorage + The recorder is not in the valid state. + The access to the resources can not be granted. + The has already been disposed. + + - - + - Get/Set the file format for recording media stream. + Cancels recording. + The recording data is discarded and not written. - Must set . - The recorder state must be state. + The recorder state must be state by or + state by . - The format does not valid. - + The recorder is not in the valid state. + The has already been disposed. + + - + - The audio codec for encoding an audio stream. + Pushes a packet as recording raw data. + An audio or video packet to record. - Must set or - by + The recorder state must be state by . - The codec does not valid. - + + The recorder is not in the valid state.\n + -or-\n + is an audio packet but audio recording is not enabled(See ).\n + -or-\n + is a video packet but video recording is not enabled(See ).\n + -or-\n + is a video packet but the does not match the video source format.\n + -or-\n + An internal error occurs. + + The has already been disposed. + + + + - + - The video codec for encoding video stream. + Release any unmanaged resources used by this object. - - Must set or - by - - The codec does not valid. - - + - The maximum size of a recording file in KB(kilobytes). If 0, means - unlimited recording size. + Releases the resources used by the StreamRecorder. - - After reaching the limitation, the data which is being recorded will - be discarded and not written to the file. - The recorder state must be state. - - The value set to below 0. - + + true to release both managed and unmanaged resources; false to release only unmanaged resources. + - + - The time limit of a recording file in Seconds. If 0, means unlimited recording - time. + Occurs when state is changed. - - After reaching the limitation, the data which is being recorded will - be discarded and not written to the file. - The recorder state must be state. - - The value set to below 0. - - + - The sampling rate of an audio stream in hertz. + Occurs when a buffer had consumed completely. - - The recorder state must be state. - Must set or - by . - - The value set to below 0. - + - The bitrate of an audio encoder in bits per second. + Occurs when recording status is changed. - - The recorder state must be state. - Must set or - by - - The value set to below 0. - + - The bitrate of an video encoder in bits per second. + Occurs when recording limit is reached. - - The recorder state must be state. - Must set or - by - - The value set to below 0. - + - The video frame rate for recording media stream. + Occurs when an error occurred during a recorder operation. - - The recorder state must be state. - Must set or - by - - The value set to below 0. - + - Get or Set the video source format for recording media stream. + Specifies the options associated with audio recording. - The value set to a invalid value. - + + + - + - The number of audio channel. + Initialize a new instance of the class with the specified codec. + The for encoding audio stream. - The attribute is applied only in Created state. - For mono recording, set channel to 1. - For stereo recording, set channel to 2. - The recorder state must be state. + , and will be set as default. - The value set to a invalid value. + is not valid. - + - Video resolution of the video recording. + Initialize a new instance of the class with the specified + codec, sample rate, bit rate and channel value. - - Must set or - by - The recorder state must be state. - - The value set to a invalid value. - + The for encoding audio stream. + The sample rate for encoding audio stream. + The bit rate for encoding audio stream. + The number of channels for encoding audio stream. + is not valid. + + is less than zero.\n + -or-\n + is less than or equal to zero.\n + -or-\n + is less than or equal to zero. + - + - Retrieves all the file formats supported by the stream recorder. + Gets or sets the audio codec for encoding an audio stream. - - It returns a list containing all the supported file - formats by Stream recorder. - - + The codec for audio stream recording. + is not valid. + - + - Retrieves all the audio encoders supported by the recorder. + Gets or sets the sampling rate of the audio stream in hertz. - - It returns a list containing all the supported audio encoders - by recorder. - - + If the value is zero, the sample rate will be decided based on input buffers. + The sample rate value for stream recorder. The default is zero. + is less than zero. - + - Retrieves all the video encoders supported by the recorder. + Gets or sets the bit rate of the audio encoder in bits per second. - - It returns a list containing all the supported video encoders - by recorder. - - + The bit rate value for audio stream recording. The default is 128000. + is less than or equal to zero. - + - Retrieves all the video resolutions supported by the recorder. + Gets or sets the number of audio channels. - - It returns videoresolution list containing the width and height of - different resolutions supported by recorder. - - + The number of audio channels for audio stream recording. The default is 2. + is less than or equal to zero. - + - Prepare the stream recorder. + Provides data for the event. - - Before calling the function, it is required to set , - , and properties of recorder. - - The streamrecorder is not in the valid state. - - + - Resets the stream recorder. + Gets the packet that has consumed. - - The recorder state must be state by , and . - The StreamRecorder state will be . - - The streamrecorder is not in the valid state. - - + - Starts the recording. + Specifies errors for / - - If file path has been set to an existing file, this file is removed automatically and updated by new one. - The filename should be set before this function is invoked. - The recorder state must be state by or - state by . - The filename shuild be set by - - The streamrecorder is not in the valid state. - The access ot the resources can not be granted. - - - - - - + - Pause the recording. + Internal error. - - Recording can be resumed with . - - The streamrecorder is not in the valid state. - - - - + - Stops recording and saves the result. + Out of storage. - - The recorder state must be state by or - state by - When you want to record audio or video file, you need to add privilege according to rules below additionally. - - http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. - http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. - - - The streamrecorder is not in the valid state. - The access ot the resources can not be granted. - - - + - Cancels the recording. - The recording data is discarded and not written in the recording file. + Specifies the video source formats for . - - - + - Push stream buffer as recording raw data. + Nv12 format. - + - Set the source type of pushed data. + Nv21 format. - + - Release any unmanaged resources used by this object. + I420 format. @@ -413,52 +386,7 @@ - State changed noti. - - - - - Enumeration for the recording limit type. - - - - - Time limit in seconds of recording file - - - - - Size limit in KB(KiloBytes) of recording file. - - - - - Enumeration for stream recorder states. - - - - - Stream recorder is not created. - - - - - Stream recorder is created, but not prepared. - - - - - Stream recorder is ready to record. - - - - - Stream recorder is recording pushed packet. - - - - - Stream recorder is paused. + State changed. @@ -496,124 +424,217 @@ Audio/Video both - - - Enumeration for video source format. - - - + - Nv12 Video source format + Provides data for the event. - + - Nv21 video source format + Gets the error code. - + - I420 video source format + Gets the state of the recorder. - + - Enumeration for stream recorder failure error. + Specifies the options associated with . + + + + - + - Sucessful. + Initialize a new instance of the class with the specified + save path and file format. + The path that the recording result is saved. + The file format of output file. + is null. + + is an empty string.\n + -or-\n + is not valid. + - + - Internal error. + Gets or sets the file path to record. + + If the same file already exists in the file system, then old file will be overwritten. + + is null. + is an empty string. - + - Internal error. + Gets or sets the file format for recording media stream. + is not valid. + - + - Out of memory. + Gets or sets the time limit of recording. + + The maximum time of recording in seconds, or 0 for unlimited time. + + + After reaching the limitation, the data which is being recorded will + be discarded and not written to the file. + The recorder state must be state. + + is less than zero. + + - + - An extended Eventargs class which contains interrupted policy details, previous and current - state of the recorder. + Gets or sets the maximum size of a recording file. + + The maximum size of a recording file in kilobytes, or 0 for unlimited size. + + + After reaching the limitation, the data which is being recorded will + be discarded and not written to the file. + + is less than zero. + + - + - The previous state of the stream recorder. + Gets or sets the options for audio recording. + + or must be set for recording. + + - + - The current state of the stream recorder. + Gets or sets the options for video recording. + + or must be set for recording. + + - + - The notify of the event. + Provides data for the event. - + - Resolution for stream recorder. + Gets the previous state of the stream recorder. - + - The video width. + Gets the current state of the stream recorder. - The width. - + - The video height. + Specifies the options associated with video recording. - The height. + + + - + - An extended EventArgs. + Initialize a new instance of the class with the specified + codec, resolution, source format and frame rate. + The for encoding video stream. + The resolution of video recording. + The format of source stream. + The frame rate for encoding video stream. + + will be set as default. + + + is not valid.\n + -or-\n + is not valid.\n + + + Width or height of is less than or equal to zero.\n + -or-\n + is less than or equal to zero.\n + - + - Consumed buffer. + Initialize a new instance of the class with the specified + codec, resolution, source format, frame rate and bit rate. + The for encoding video stream. + The resolution of video recording. + The format of source stream. + The frame rate for encoding video stream. + The bit rate for encoding video stream. + + is not valid.\n + -or-\n + is not valid.\n + + + Width or height of is less than or equal to zero.\n + -or-\n + is less than or equal to zero.\n + -or-\n + is less than zero. + - + - An extended EventArgs class which contains details about error status and - state of the recorder when it failed. + Gets or sets the video codec for encoding video stream. + The codec for video stream recording. + is not valid. + - + - The error code. + Gets or sets the resolution of the video recording. + The output resolution for video stream recording. + + Width or height of is less than or equal to zero. + + - + - The state of the recorder. + Gets or sets the frame rate for recording media stream. + The frame rate value for video stream recording. + is less than or equal to zero. - + - An extended EventArgs class containing details about the recording limit. + Gets or sets the video source format for recording media stream. + The source format of buffers for video stream recording. + is not valid. - + - The limitation type. + The bit rate of the video encoder in bits per second. + The bit rate value for video stream recording. The default is 0. + is less than zero. diff --git a/Artifacts/bin/public/Tizen.Multimedia.dll b/Artifacts/bin/public/Tizen.Multimedia.dll index b058877..63012c8 100644 Binary files a/Artifacts/bin/public/Tizen.Multimedia.dll and b/Artifacts/bin/public/Tizen.Multimedia.dll differ diff --git a/Artifacts/bin/public/Tizen.NUI.dll b/Artifacts/bin/public/Tizen.NUI.dll index dda9c7a..4cb955f 100644 Binary files a/Artifacts/bin/public/Tizen.NUI.dll and b/Artifacts/bin/public/Tizen.NUI.dll differ diff --git a/Artifacts/bin/public/Tizen.NUI.pdb b/Artifacts/bin/public/Tizen.NUI.pdb index 5ab65c4..b86795a 100644 Binary files a/Artifacts/bin/public/Tizen.NUI.pdb and b/Artifacts/bin/public/Tizen.NUI.pdb differ diff --git a/Artifacts/bin/public/Tizen.NUI.xml b/Artifacts/bin/public/Tizen.NUI.xml index 4b7f359..4c61a5a 100644 --- a/Artifacts/bin/public/Tizen.NUI.xml +++ b/Artifacts/bin/public/Tizen.NUI.xml @@ -223,6 +223,13 @@ + + + Ensures that the function passed in is called from the main loop when it is idle. + + The function to call + true if added successfully, false otherwise + Outer::outer_method(int) @@ -316,6 +323,13 @@ Exit Application. + + + Ensures that the function passed in is called from the main loop when it is idle. + + The function to call + true if added successfully, false otherwise + Run Application. @@ -406,6 +420,87 @@ Converts a string to NUIEventType instance. + + + Application instance to connect event. + + + + + Dictionary to contain each type of event callback. + + + + + The default Constructor. + + + + + The constructor with stylesheet. + + + + + Add NUIWidgetApplication event to Application. + Put each type of event callback in Dictionary. + + Type of event + Event callback + + + + Add NUIWidgetApplication event to Application. + Put each type of event callback in Dictionary. + + Argument type for the event + Type of event + Event callback + + + + Dispose function. + + + + + Exit Application. + + + + + Run Application. + + Arguments from commandline. + + + + Region changed event callback function. + + Application instance + Event argument for RegionChanged + + + + Memory Low event callback function. + + Application instance + Event argument for MemoryLow + + + + Language changed event callback function. + + Application instance + Event argument for LanguageChanged + + + + Battery low event callback function. + + Application instance + Event argument for BatteryLow + @brief Event arguments that passed via Notify signal @@ -609,6 +704,79 @@ collection but not when one of the elements of the collection is modified as it is a bit tricky to detect unmanaged code that modifies the collection under our feet. + + + Widget application + + + + + To make Window instance be disposed. + + + + + This starts the application. + + + + + This quits the application. + Tizen applications should use Lower to improve re-start performance unless they need to Quit completely. + + + + + Get window. + + The window for widget instance. + + + + Get path application resources are stored at. + + The full path of the resources + + + + Event arguments that passed via widget app event signal. + + + + + Widget application. + + + + + Init event. + + + + + Terminate event. + + + + + LanguageChanged event. + + + + + RegionChanged event. + + + + + BatteryLow event. + + + + + MemoryLow event. + + An Adaptor object is used to initialize and control how Dali runs. @@ -958,7 +1126,7 @@ The delay time is not included in the looping time.
When the delay time is negative value, it would treat as play immediately.
- The delay time + The delay time
@@ -2275,13 +2443,9 @@ - - - The line count of text. - - - + + VideoView is a control for video playback and display. @@ -2356,6 +2520,38 @@ View is the base class for all views. + + + Adds a child view to this View. + + + + + + + Removes a child View from this View. If the view was not a child of this view, this is a no-op. + + + + + + + Retrieves child view by index. + + + + + + + Retrieves the number of children held by the view. + + + + + + + + @@ -2559,7 +2755,6 @@ - @@ -2668,43 +2863,12 @@ Will be lowered below this view - - - Adds a child view to this View. - -
This View(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.
- The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. - If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view. - The child -
- - - Removes a child View from this View. If the view was not a child of this view, this is a no-op. - -
This View(the parent) has been initialized. The child view is not the same as the parent view.
- The child -
Removes a View from its Parent View / Layer. If the View has no parent, this method does nothing.
The (child) View has been initialized. 
- - - Retrieves the number of children held by the view. - -
The View has been initialized.
- The number of children -
- - - Retrieves child view by index. - -
The View has been initialized.
- The index of the child to retrieve - The view for the given index or empty handle if children not initialized -
Search through this view's hierarchy for an view with the given name. @@ -3125,6 +3289,68 @@ A Color to be converted to Vector4 + + + + Container is an abstract class to be inherited from by classes that desire to have Views + added to them. + + + + + + Adds a child view to this Container. + +
This Container(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.
+ The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. + If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view. + The child view to add +
+ + + Removes a child View from this View. If the view was not a child of this view, this is a no-op. + +
This View(the parent) has been initialized. The child view is not the same as the parent view.
+ The child +
+ + + Retrieves child view by index. + +
The View has been initialized.
+ The index of the child to retrieve + The view for the given index or empty handle if children not initialized +
+ + + Get the parent of this container + +
The child container has been initialized.
+ The parent container +
+ + + Get the number of children for this container + +
The container has been initialized.
+ number of children +
+ + + Get the parent Container + Read only + +
The child container has been initialized.
+ The parent container +
+ + + Get the number of children for this container + Read only + +
The container has been initialized.
+ number of children +
Spin CustomView class @@ -4436,6 +4662,29 @@ Layers provide a mechanism for overlaying groups of actors on top of each other. + + from Container base class + + Adds a child view to this layer. + + + + + + + Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. + + + + + + + Retrieves child view by index. + +
The View has been initialized.
+ The index of the child to retrieve + The view for the given index or empty handle if children not initialized +
Creates a Layer object. @@ -4450,22 +4699,6 @@ The id of the child to find A handle to the view if found, or an empty handle if not. - - - Adds a child view to this layer. - -
This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.
- The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. - If the child already has a parent, it will be removed from old parent and reparented to this layer. This may change child's position, color, scale etc as it now inherits them from this layer. - The child -
- - - Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. - -
This layer(the parent) has been initialized. The child view is not the same as the parent view.
- The child -
@@ -4489,14 +4722,6 @@ - - - Retrieves child view by index. - -
The View has been initialized.
- The index of the child to retrieve - The view for the given index or empty handle if children not initialized -
Enumeration for the behavior of the layer. @@ -4641,6 +4866,13 @@ Exit NUIApplication. + + + Ensures that the function passed in is called from the main loop when it is idle. + + The function to call + true if added successfully, false otherwise + Enumeration for deciding whether a NUI application window is opaque or transparent. @@ -5570,6 +5802,72 @@ character will move character by character to next line + + + Represents an application that have UI screen. The NUIWidgetApplication class has a default stage. + + + + + The default constructor. + + + + + The constructor with stylesheet. + + + + + Overrides this method if want to handle behavior. + + + + + Overrides this method if want to handle behavior. + + + + + Overrides this method if want to handle behavior. + + + + + Overrides this method if want to handle behavior. + + + + + Overrides this method if want to handle behavior. + + + + + Overrides this method if want to handle behavior. + + + + + Overrides this method if want to handle behavior. + + + + + Run NUIWidgetApplication. + + Arguments from commandline. + + + + Exit NUIWidgetApplication. + + + + + Get the window instance. + + @@ -9286,6 +9584,237 @@ The type of the wheel event
+ + + Widget object should be created by WidgetApplication. + + + + + To make Widget instance be disposed. + + + + + This is the constructor for Widget. + + for widget instance + + + + Event arguments that passed via KeyEvent signal. + + + + + widget data. + + + + + a bundle. + + + + + window size. + + + + + Create event. + + + + + Event arguments that passed via terminate event signal. + + + + + widget data. + + + + + a bundle. + + + + + widget terminate type. + + + + + Terminate event. + + + + + Event arguments that passed via pause event signal. + + + + + widget data. + + + + + Pause event. + + + + + Event arguments that passed via pause event signal. + + + + + widget data. + + + + + Resume event. + + + + + Event arguments that passed via resize signal. + + + + + widget data. + + + + + window size. + + + + + Resize event. + + + + + Event arguments that passed via update event signal. + + + + + widget data. + + + + + A bundle. + + + + + It means several steps. + + + 0 -> no force + 1 -> force but do someting + 2 -> force + + + + + Update event. + + + + + Enumeration for terminate type of widget instance. + + + + + User deleted this widget from the viewer + + + + + Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) + + + + + Enumeration for lifecycle event type of widget instance. + + + + + The widget is dead. + + + + + The widget is dead. + + + + + The widget is destroyed. + + + + + The widget is paused. + + + + + The widget is resumed. + + + + + Widget data. + + + + + To make Window instance be disposed. + + + + + Get widget instance id. + + Id of widget instance. + + + + Get widget instance content. + + Content of widget instance. + + + + Get widget instance Window. + + Window of widget instance + + + + Set widget instance arguments. + + Content of widget instance + + + + Set widget instance arguments. + + Window of widget instance. + @@ -9552,6 +10081,18 @@ The preffered brightness. + + + Gets/Sets a window title. + + + + + Sets the window name and class string. + + The name of the window + The class of the window + Raises window to the top of Window stack. diff --git a/Artifacts/bin/public/Tizen.Network.Nsd.dll b/Artifacts/bin/public/Tizen.Network.Nsd.dll index 46d5ae7..43b7bb9 100644 Binary files a/Artifacts/bin/public/Tizen.Network.Nsd.dll and b/Artifacts/bin/public/Tizen.Network.Nsd.dll differ diff --git a/Artifacts/bin/public/Tizen.Network.Nsd.pdb b/Artifacts/bin/public/Tizen.Network.Nsd.pdb index 9b02046..696d667 100644 Binary files a/Artifacts/bin/public/Tizen.Network.Nsd.pdb and b/Artifacts/bin/public/Tizen.Network.Nsd.pdb differ diff --git a/Artifacts/bin/public/Tizen.Network.Nsd.xml b/Artifacts/bin/public/Tizen.Network.Nsd.xml index c56e5b3..8e076cf 100644 --- a/Artifacts/bin/public/Tizen.Network.Nsd.xml +++ b/Artifacts/bin/public/Tizen.Network.Nsd.xml @@ -32,7 +32,7 @@ The DNSSD service type 4 - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown when serviceType is null. Thrown when DNSSD is not supported. @@ -46,7 +46,7 @@ 4 http://tizen.org/privilege/internet - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown when any other error occurred. Thrown when DNSSD is not supported. Thrown when permission is denied. @@ -56,7 +56,7 @@ Stops browsing the DNSSD remote service.
4 - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown when any other error occurred. Thrown when DNSSD is not supported.
@@ -74,7 +74,7 @@ The DNSSD service type. It is expressed as type followed by protocol, separated by a dot(e.g. "_ftp._tcp"). It must begin with an underscore, followed by 1-15 characters which may be letters, digits or hyphens. - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown while setting this property when DNSSD is not supported. Thrown when serviceType is set to null. @@ -88,7 +88,7 @@ In case of error, null will be returned during get and exception will be thrown during set. 4 - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown while setting this property when DNSSD is not supported. Thrown when Name value is set to null. Thrown while setting this property when any other error occurred. @@ -113,7 +113,7 @@ In case of error, -1 will be returned during get and exception will be thrown during set. 4 - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown while setting this property when DNSSD is not supported. Thrown if value of Port is set to less than 0 or more than 65535. Thrown while setting this property when any other error occurred. @@ -138,7 +138,7 @@ 4 The key of the TXT record. It must be a null-terminated string with 9 characters or fewer excluding null. It is case insensitive. The value of the TXT record.If null, then "key" will be added with no value. If non-null but value_length is zero, then "key=" will be added with empty value. - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown when DNSSD is not supported. Thrown when value of key is null. Thrown when any other error occurred. @@ -149,7 +149,7 @@
4 The key of the TXT record to be removed. - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown when DNSSD is not supported. Thrown when value of key is null. Thrown when any other error occurred. @@ -161,7 +161,7 @@ Name of the service must be set. 4 http://tizen.org/privilege/internet - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown when any other error occurred. Thrown when DNSSD is not supported. Thrown when permission is denied. @@ -174,7 +174,7 @@ A local service registered using RegisterService() must be passed. 4 - http://tizen.org/feature/network.dnssd + http://tizen.org/feature/network.service_discovery.dnssd Thrown when any other error occurred. Thrown when DNSSD is not supported.
@@ -217,8 +217,8 @@ 4 http://tizen.org/privilege/internet - http://tizen.org/feature/network.dnssd - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.dnssd + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occured. Thrown when DNSSD/SSDP is not supported. Thrown when permission is denied. @@ -228,8 +228,8 @@ Stops browsing the DNSSD/SSDP remote service.
4 - http://tizen.org/feature/network.dnssd - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.dnssd + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occured. Thrown when DNSSD/SSDP is not supported.
@@ -247,8 +247,8 @@ 4 http://tizen.org/privilege/internet - http://tizen.org/feature/network.dnssd - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.dnssd + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occurred. Thrown when DNSSD/SSDP is not supported. Thrown when permission is denied. @@ -261,8 +261,8 @@ A local service registered using RegisterService() must be passed. 4 - http://tizen.org/feature/network.dnssd - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.dnssd + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occurred. Thrown when DNSSD/SSDP is not supported. @@ -367,7 +367,7 @@ 4 The target to browse for the service. - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown when target is null. Thrown when SSDP is not supported. @@ -380,7 +380,7 @@ Application will keep browsing for available/unavailable services until it calls StopDiscovery(). 4 - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occured. Thrown when SSDP is not supported. @@ -390,7 +390,7 @@ 4 http://tizen.org/privilege/internet - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occured. Thrown when SSDP is not supported. Thrown when permission is denied. @@ -407,7 +407,7 @@ 4 The SSDP local service's target. It may be a device type or a service type. - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown while setting this property when SSDP is not supported. Thrown when target is set to null. @@ -420,7 +420,7 @@ In case of error, null will be returned during get and exception will be thrown during set. 4 - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown while setting this property when SSDP is not supported. Thrown when Usn value is set to null. Thrown while setting this property when any other error occurred. @@ -444,7 +444,7 @@ In case of error, null will be returned during get and exception will be thrown during set. 4 - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown while setting this property when SSDP is not supported. Thrown when Url value is set to null. Thrown while setting this property when any other error occurred. @@ -459,7 +459,7 @@ 4 http://tizen.org/privilege/internet - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occurred. Thrown when SSDP is not supported. Thrown when permission is denied. @@ -472,7 +472,7 @@ A local service registered using RegisterService() must be passed. 4 - http://tizen.org/feature/network.ssdp + http://tizen.org/feature/network.service_discovery.ssdp Thrown when any other error occurred. Thrown when SSDP is not supported. diff --git a/Artifacts/bin/public/Tizen.Pims.Contacts.dll b/Artifacts/bin/public/Tizen.Pims.Contacts.dll index ea40ede..05c98a9 100644 Binary files a/Artifacts/bin/public/Tizen.Pims.Contacts.dll and b/Artifacts/bin/public/Tizen.Pims.Contacts.dll differ diff --git a/Artifacts/bin/public/Tizen.Pims.Contacts.pdb b/Artifacts/bin/public/Tizen.Pims.Contacts.pdb index aa3f130..0230fb5 100644 Binary files a/Artifacts/bin/public/Tizen.Pims.Contacts.pdb and b/Artifacts/bin/public/Tizen.Pims.Contacts.pdb differ diff --git a/Artifacts/bin/public/Tizen.Pims.Contacts.xml b/Artifacts/bin/public/Tizen.Pims.Contacts.xml index 71063da..7a294b2 100644 --- a/Artifacts/bin/public/Tizen.Pims.Contacts.xml +++ b/Artifacts/bin/public/Tizen.Pims.Contacts.xml @@ -405,16 +405,16 @@ The query used for filtering the results The count of records - + - Registers a callback function to be invoked when a record changes. + Registers a EventHandler to be invoked when a record changes. The view URI of records whose changes are monitored The EventHandler to register - + - Deregisters a callback function. + Deregisters a EventHandler. The view URI of records whose changes are monitored The EventHandler to deregister diff --git a/packaging/csapi-tizenfx.spec b/packaging/csapi-tizenfx.spec index 7c9fb73..8cac95e 100644 --- a/packaging/csapi-tizenfx.spec +++ b/packaging/csapi-tizenfx.spec @@ -10,7 +10,7 @@ Name: csapi-tizenfx Summary: Assemblies of Tizen .NET -Version: 4.0.0.175 +Version: 4.0.0.183 Release: 1 Group: Development/Libraries License: Apache-2.0 diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs index 2e9a979..264db10 100755 --- a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs @@ -81,8 +81,8 @@ namespace Tizen.Applications certificates.Add(CertificateType.Distributor, new PackageCertificate(distRootCertificate, distIntermediateCertificate, distSignerCertificate)); string dist2RootCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2RootCertificate); - string dist2IntermediateCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2RootCertificate); - string dist2SignerCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2RootCertificate); + string dist2IntermediateCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2IntermediateCertificate); + string dist2SignerCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2SignerCertificate); certificates.Add(CertificateType.Distributor2, new PackageCertificate(dist2RootCertificate, dist2IntermediateCertificate, dist2SignerCertificate)); return certificates; diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Capabilities.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Capabilities.cs new file mode 100644 index 0000000..133674e --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Capabilities.cs @@ -0,0 +1,37 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class StreamRecorder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FileFormatCallback(StreamRecorderFileFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AudioEncoderCallback(StreamRecorderAudioCodec codec, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoEncoderCallback(StreamRecorderVideoCodec codec, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_file_format")] + internal static extern StreamRecorderErrorCode FileFormats(StreamRecorderHandle handle, + FileFormatCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_audio_encoder")] + internal static extern StreamRecorderErrorCode AudioEncoders(StreamRecorderHandle handle, + AudioEncoderCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_encoder")] + internal static extern StreamRecorderErrorCode VideoEncoders(StreamRecorderHandle handle, + VideoEncoderCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_resolution")] + internal static extern StreamRecorderErrorCode VideoResolution(StreamRecorderHandle handle, + VideoResolutionCallback callback, IntPtr userData = default(IntPtr)); + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Events.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Events.cs new file mode 100644 index 0000000..e7febae --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Events.cs @@ -0,0 +1,61 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class StreamRecorder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingLimitReachedCallback(RecordingLimitType type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingStatusCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void NotifiedCallback(int previous, int current, + StreamRecorderNotify notify, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecorderErrorCallback(StreamRecorderErrorCode error, + RecorderState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BufferConsumedCallback(IntPtr buffer, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_notify_cb")] + internal static extern StreamRecorderErrorCode SetNotifiedCallback(StreamRecorderHandle handle, + NotifiedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_notify_cb")] + internal static extern int UnsetNotifiedCallback(StreamRecorderHandle handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_status_cb")] + internal static extern StreamRecorderErrorCode SetStatusChangedCallback(StreamRecorderHandle handle, + RecordingStatusCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_status_cb")] + internal static extern int UnsetStatusChangedCallback(StreamRecorderHandle handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit_reached_cb")] + internal static extern StreamRecorderErrorCode SetLimitReachedCallback(StreamRecorderHandle handle, + RecordingLimitReachedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_limit_reached_cb")] + internal static extern int UnsetLimitReachedCallback(StreamRecorderHandle handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_error_cb")] + internal static extern StreamRecorderErrorCode SetErrorCallback(StreamRecorderHandle handle, + RecorderErrorCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_error_cb")] + internal static extern int UnsetErrorCallback(StreamRecorderHandle handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_buffer_consume_completed_cb")] + internal static extern StreamRecorderErrorCode SetBufferConsumedCallback(StreamRecorderHandle handle, + BufferConsumedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_buffer_consume_completed_cb")] + internal static extern int UnsetBufferConsumedCallback(StreamRecorderHandle handle); + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Settings.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Settings.cs new file mode 100644 index 0000000..a8fabbb --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.Settings.cs @@ -0,0 +1,88 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class StreamRecorder + { + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_filename")] + internal static extern StreamRecorderErrorCode SetFileName(StreamRecorderHandle handle, string path); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_filename")] + internal static extern int GetFileName(StreamRecorderHandle handle, out IntPtr path); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_file_format")] + internal static extern StreamRecorderErrorCode SetFileFormat(StreamRecorderHandle handle, + StreamRecorderFileFormat format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_file_format")] + internal static extern int GetFileFormat(StreamRecorderHandle handle, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder")] + internal static extern StreamRecorderErrorCode SetAudioEncoder(StreamRecorderHandle handle, + StreamRecorderAudioCodec codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder")] + internal static extern int GetAudioEncoder(StreamRecorderHandle handle, out int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder")] + internal static extern StreamRecorderErrorCode SetVideoEncoder(StreamRecorderHandle handle, + StreamRecorderVideoCodec codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder")] + internal static extern int GetVideoEncoder(StreamRecorderHandle handle, out int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_resolution")] + internal static extern StreamRecorderErrorCode SetVideoResolution(StreamRecorderHandle handle, + int width, int height); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_resolution")] + internal static extern StreamRecorderErrorCode GetVideoResolution(StreamRecorderHandle handle, + out int width, out int height); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_framerate")] + internal static extern StreamRecorderErrorCode SetVideoFrameRate(StreamRecorderHandle handle, int framerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_framerate")] + internal static extern int GetVideoFramerate(StreamRecorderHandle handle, out int framerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_source_format")] + internal static extern StreamRecorderErrorCode SetVideoSourceFormat(StreamRecorderHandle handle, + StreamRecorderVideoFormat format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_source_format")] + internal static extern int GetVideoSourceFormat(StreamRecorderHandle handle, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit")] + internal static extern StreamRecorderErrorCode SetRecordingLimit(StreamRecorderHandle handle, + RecordingLimitType type, int limit); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_recording_limit")] + internal static extern int GetRecordingLimit(StreamRecorderHandle handle, int type, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_samplerate")] + internal static extern StreamRecorderErrorCode SetAudioSampleRate(StreamRecorderHandle handle, int samplerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_samplerate")] + internal static extern int GetAudioSampleRate(StreamRecorderHandle handle, out int samplerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder_bitrate")] + internal static extern StreamRecorderErrorCode SetAudioEncoderBitrate(StreamRecorderHandle handle, int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder_bitrate")] + internal static extern int GetAudioEncoderBitrate(StreamRecorderHandle handle, out int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder_bitrate")] + internal static extern StreamRecorderErrorCode SetVideoEncoderBitRate(StreamRecorderHandle handle, int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder_bitrate")] + internal static extern int GetVideoEncoderBitrate(StreamRecorderHandle handle, out int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_channel")] + internal static extern StreamRecorderErrorCode SetAudioChannel(StreamRecorderHandle handle, int channel); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_channel")] + internal static extern int GetAudioChannel(StreamRecorderHandle handle, out int channel); + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs index dd79eab..e7f061b 100644 --- a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs @@ -6,181 +6,72 @@ internal static partial class Interop { internal static partial class StreamRecorder { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecordingLimitReachedCallback(StreamRecordingLimitType type, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecordingStatusCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void NotifiedCallback(StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notfication, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void RecorderErrorCallback(StreamRecorderErrorCode error, StreamRecorderState current, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate void BufferConsumedCallback(IntPtr buffer, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool FileFormatCallback(StreamRecorderFileFormat format, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool AudioEncoderCallback(StreamRecorderAudioCodec codec, IntPtr userData); - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate bool VideoEncoderCallback(StreamRecorderVideoCodec codec, IntPtr userData); - - /* begin of method */ [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_create")] - internal static extern int Create(out IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_destroy")] - internal static extern int Destroy(IntPtr handle); + internal static extern StreamRecorderErrorCode Create(out StreamRecorderHandle handle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_prepare")] - internal static extern int Prepare(IntPtr handle); + internal static extern StreamRecorderErrorCode Prepare(StreamRecorderHandle handle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unprepare")] - internal static extern int Unprepare(IntPtr handle); + internal static extern StreamRecorderErrorCode Unprepare(StreamRecorderHandle handle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_start")] - internal static extern int Start(IntPtr handle); + internal static extern StreamRecorderErrorCode Start(StreamRecorderHandle handle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_pause")] - internal static extern int Pause(IntPtr handle); + internal static extern StreamRecorderErrorCode Pause(StreamRecorderHandle handle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_commit")] - internal static extern int Commit(IntPtr handle); + internal static extern StreamRecorderErrorCode Commit(StreamRecorderHandle handle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_cancel")] - internal static extern int Cancel(IntPtr handle); + internal static extern StreamRecorderErrorCode Cancel(StreamRecorderHandle handle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_push_stream_buffer")] - internal static extern int PushStreamBuffer(IntPtr handle, IntPtr/* media_packet_h */ inbuf); + internal static extern StreamRecorderErrorCode PushStreamBuffer(StreamRecorderHandle handle, + IntPtr mediaPacketHandle); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_enable_source_buffer")] - internal static extern int EnableSourceBuffer(IntPtr handle, int type); + internal static extern StreamRecorderErrorCode EnableSourceBuffer(StreamRecorderHandle handle, + StreamRecorderSourceType type); [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_state")] - internal static extern int GetState(IntPtr handle, out int state); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_filename")] - internal static extern int SetFileName(IntPtr handle, string path); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_filename")] - internal static extern int GetFileName(IntPtr handle, out IntPtr path); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_file_format")] - internal static extern int SetFileFormat(IntPtr handle, int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_file_format")] - internal static extern int GetFileFormat(IntPtr handle, out int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder")] - internal static extern int SetAudioEncoder(IntPtr handle, int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder")] - internal static extern int GetAudioEncoder(IntPtr handle, out int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder")] - internal static extern int SetVideoEncoder(IntPtr handle, int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder")] - internal static extern int GetVideoEncoder(IntPtr handle, out int codec); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_resolution")] - internal static extern int SetVideoResolution(IntPtr handle, int width, int height); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_resolution")] - internal static extern int GetVideoResolution(IntPtr handle, out int width, out int height); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_framerate")] - internal static extern int SetVideoFramerate(IntPtr handle, int framerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_framerate")] - internal static extern int GetVideoFramerate(IntPtr handle, out int framerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_source_format")] - internal static extern int SetVideoSourceFormat(IntPtr handle, int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_source_format")] - internal static extern int GetVideoSourceFormat(IntPtr handle, out int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit")] - internal static extern int SetRecordingLimit(IntPtr handle, int type, int limit); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_recording_limit")] - internal static extern int GetRecordingLimit(IntPtr handle, int type, out int format); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_samplerate")] - internal static extern int SetAudioSampleRate(IntPtr handle, int samplerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_samplerate")] - internal static extern int GetAudioSampleRate(IntPtr handle, out int samplerate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder_bitrate")] - internal static extern int SetAudioEncoderBitrate(IntPtr handle, int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder_bitrate")] - internal static extern int GetAudioEncoderBitrate(IntPtr handle, out int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder_bitrate")] - internal static extern int SetVideoEncoderBitrate(IntPtr handle, int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder_bitrate")] - internal static extern int GetVideoEncoderBitrate(IntPtr handle, out int bitrate); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_channel")] - internal static extern int SetAudioChannel(IntPtr handle, int channel); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_channel")] - internal static extern int GetAudioChannel(IntPtr handle, out int channel); - /* End of method */ - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_file_format")] - internal static extern int FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_audio_encoder")] - internal static extern int AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_encoder")] - internal static extern int VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_resolution")] - internal static extern int VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData); - /* End of foreach method */ - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_notify_cb")] - internal static extern int SetNotifiedCallback(IntPtr handle, NotifiedCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_notify_cb")] - internal static extern int UnsetNotifiedCallback(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_status_cb")] - internal static extern int SetStatusChangedCallback(IntPtr handle, RecordingStatusCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_status_cb")] - internal static extern int UnsetStatusChangedCallback(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit_reached_cb")] - internal static extern int SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_limit_reached_cb")] - internal static extern int UnsetLimitReachedCallback(IntPtr handle); - - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_error_cb")] - internal static extern int SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData); + internal static extern StreamRecorderErrorCode GetState(StreamRecorderHandle handle, out RecorderState state); + } - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_error_cb")] - internal static extern int UnsetErrorCallback(IntPtr handle); + internal class StreamRecorderHandle : SafeHandle + { + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_destroy")] + private static extern StreamRecorderErrorCode Destroy(IntPtr handle); - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_buffer_consume_completed_cb")] - internal static extern int SetBufferConsumedCallback(IntPtr handle, BufferConsumedCallback callback, IntPtr userDat); + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_cancel")] + private static extern StreamRecorderErrorCode Cancel(IntPtr handle); - [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_buffer_consume_completed_cb")] - internal static extern int UnsetBufferConsumedCallback(IntPtr handle); + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unprepare")] + private static extern StreamRecorderErrorCode Unprepare(IntPtr handle); + + protected StreamRecorderHandle() : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + protected override bool ReleaseHandle() + { + try + { + Cancel(handle).Ignore(StreamRecorderErrorCode.InvalidState).ThrowIfError("Failed to cancel."); + Unprepare(handle).Ignore(StreamRecorderErrorCode.InvalidState).ThrowIfError("Failed to unprepare."); + Destroy(handle).ThrowIfError("Failed to destory."); + + return true; + } + catch (Exception e) + { + Tizen.Log.Debug(GetType().FullName, $"Failed to release native RecorderHandle; {e.Message}"); + + return false; + } + } } } diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.Capabilities.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.Capabilities.cs new file mode 100644 index 0000000..4ba2137 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.Capabilities.cs @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using Native = Interop.StreamRecorder; + +namespace Tizen.Multimedia +{ + public partial class StreamRecorder + { + internal void LoadCapabilities() + { + _videoCodecs = LoadVideoCodecs(this); + _audioCodecs = LoadAudioCodecs(this); + _fileFormats = LoadFileFormats(this); + _videoResolutions = LoadResolutions(this); + } + + private static IEnumerable LoadVideoCodecs(StreamRecorder recorder) + { + var result = new List(); + Native.VideoEncoderCallback callback = (codec, _) => + { + result.Add(codec.ToRecorderEnum()); + return true; + }; + + Native.VideoEncoders(recorder.Handle, callback).ThrowIfError("Failed to get the supported video codecs."); + + return result.AsReadOnly(); + } + + private static IEnumerable LoadAudioCodecs(StreamRecorder recorder) + { + var result = new List(); + + Native.AudioEncoders(recorder.Handle, (codec, _) => + { + result.Add(codec.ToRecorderEnum()); + return true; + }).ThrowIfError("Failed to get the supported audio codecs."); + + return result.AsReadOnly(); + } + + private static IEnumerable LoadFileFormats(StreamRecorder recorder) + { + var result = new List(); + + Native.FileFormats(recorder.Handle, (fileFormat, _) => + { + result.Add(fileFormat.ToRecorderEnum()); + return true; + }).ThrowIfError("Failed to get the supported file formats."); + + return result.AsReadOnly(); + } + + private static IEnumerable LoadResolutions(StreamRecorder recorder) + { + List result = new List(); + + Native.VideoResolutionCallback callback = (width, height, _) => + { + result.Add(new Size(width, height)); + return true; + }; + + Native.VideoResolution(recorder.Handle, callback). + ThrowIfError("Failed to get the supported video resolutions."); + + return result.AsReadOnly(); + } + + private IEnumerable _fileFormats; + + /// + /// Gets the file formats that the current device supports. + /// + /// An IEnumerable of representing the supported file formats. + public IEnumerable GetSupportedFileFormats() => _fileFormats; + + private IEnumerable _audioCodecs; + + /// + /// Gets the audio codecs that the current device supports. + /// + /// An IEnumerable of representing the supported audio codecs. + public IEnumerable GetSupportedAudioCodecs() => _audioCodecs; + + private IEnumerable _videoCodecs; + + /// + /// Gets the video codecs that the current device supports. + /// + /// An IEnumerable of representing the supported video codecs. + public IEnumerable GetSupportedVideoCodecs() => _videoCodecs; + + private IEnumerable _videoResolutions; + + /// + /// Gets the video resolutions that the current device supports. + /// + /// An IEnumerable of representing the supported resolutions. + public IEnumerable GetSupportedVideoResolutions() => _videoResolutions; + + internal void ValidateFileFormat(RecorderFileFormat format) + { + if (_fileFormats.Contains(format) == false) + { + throw new NotSupportedException($"{format.ToString()} is not supported."); + } + } + + internal void ValidateAudioCodec(RecorderAudioCodec codec) + { + if (_audioCodecs.Contains(codec) == false) + { + throw new NotSupportedException($"{codec.ToString()} is not supported."); + } + } + + internal void ValidateVideoCodec(RecorderVideoCodec codec) + { + if (_videoCodecs.Contains(codec) == false) + { + throw new NotSupportedException($"{codec.ToString()} is not supported."); + } + } + + internal void ValidateVideoResolution(Size resolution) + { + if (_videoResolutions.Contains(resolution) == false) + { + throw new NotSupportedException($"Resolution({resolution.ToString()}) is not supported."); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.Events.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.Events.cs new file mode 100644 index 0000000..647e3ab --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.Events.cs @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using Native = Interop.StreamRecorder; + +namespace Tizen.Multimedia +{ + public partial class StreamRecorder + { + /// + /// Occurs when state is changed. + /// + public event EventHandler StateChanged; + + + /// + /// Occurs when a buffer had consumed completely. + /// + public event EventHandler BufferConsumed; + + /// + /// Occurs when recording status is changed. + /// + public event EventHandler RecordingStatusChanged; + + /// + /// Occurs when recording limit is reached. + /// + public event EventHandler RecordingLimitReached; + + /// + /// Occurs when an error occurred during a recorder operation. + /// + public event EventHandler ErrorOccurred; + + private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback; + private Native.RecorderErrorCallback _recorderErrorCallback; + private Native.RecordingStatusCallback _recordingStatusCallback; + private Native.BufferConsumedCallback _bufferConsumedCallback; + private Native.NotifiedCallback _notifiedCallback; + + private void RegisterStreamRecorderNotifiedEvent() + { + _notifiedCallback = (previous, current, notify, _) => + { + if (previous == 0) + { + return; + } + + StateChanged?.Invoke(this, new StreamRecorderStateChangedEventArgs( + (RecorderState)previous, (RecorderState)current)); + }; + + Native.SetNotifiedCallback(_handle, _notifiedCallback). + ThrowIfError("Failed to initialize state changed event."); + } + + private void RegisterBufferConsumedEvent() + { + _bufferConsumedCallback = (lockedPacketHandle, _) => + { + MediaPacket packet = null; + + // Lock must be disposed here, note that the packet won't be disposed. + using (MediaPacket.Lock packetLock = + MediaPacket.Lock.FromHandle(lockedPacketHandle)) + { + Debug.Assert(packetLock != null); + + packet = packetLock.MediaPacket; + } + + BufferConsumed?.Invoke(this, new StreamRecorderBufferConsumedEventArgs(packet)); + }; + + Native.SetBufferConsumedCallback(_handle, _bufferConsumedCallback). + ThrowIfError("Failed to initialize buffer consumed event."); + } + + private void RegisterRecordingStatusChangedEvent() + { + _recordingStatusCallback = (elapsedTime, fileSize, _) => + { + RecordingStatusChanged?.Invoke(this, new RecordingStatusChangedEventArgs((long)elapsedTime, (long)fileSize)); + }; + Native.SetStatusChangedCallback(_handle, _recordingStatusCallback). + ThrowIfError("Failed to initialize status changed event."); + } + + private void RegisterRecordingLimitReachedEvent() + { + _recordingLimitReachedCallback = (type, _) => + { + RecordingLimitReached?.Invoke(this, new RecordingLimitReachedEventArgs(type)); + }; + + Native.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback). + ThrowIfError("Failed to initialize limit reached event."); + } + + private void RegisterRecordingErrorOccurredEvent() + { + _recorderErrorCallback = (error, currentState, _) => + { + ErrorOccurred?.Invoke(this, new StreamRecorderErrorOccurredEventArgs( + error == StreamRecorderErrorCode.OutOfStorage ? + StreamRecorderError.OutOfStorage : StreamRecorderError.InternalError, currentState)); + }; + Native.SetErrorCallback(_handle, _recorderErrorCallback). + ThrowIfError("Failed to set error callback"); + } + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs index 91cf1ee..99fd6d8 100644 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs @@ -15,1040 +15,349 @@ */ using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using Tizen.Internals.Errors; +using System.Diagnostics; +using System.Linq; +using NativeHandle = Interop.StreamRecorderHandle; using Native = Interop.StreamRecorder; namespace Tizen.Multimedia { - static internal class StreamRecorderLog - { - internal const string Tag = "Tizen.Multimedia.StreamRecorder"; - } - /// - /// Provides methods to control stream recorder. + /// Provides the ability to record user buffer from application. /// - /// - /// StreamRecorder class provides functions to record raw image frame - /// also provides recording start, stop and save the content etc. - /// - public class StreamRecorder : IDisposable + /// + public partial class StreamRecorder : IDisposable { - private IntPtr _handle; + private NativeHandle _handle; private bool _disposed = false; - /// - /// Occurred when recording is progressing for recording status. - /// - private EventHandler _recordingStatusChanged; - private Native.RecordingStatusCallback _recordingStatusCallback; - /// - /// Occurred when recording time or size reach limit. - /// - private EventHandler _recordingLimitReached; - private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback; - /// - /// Occurred when streamrecorder complete to use pushed buffer. - /// - private EventHandler _bufferConsumed; - private Native.BufferConsumedCallback _bufferConsumedCallback; - /// - /// Occurred when streamrecorder state is changed. - /// - private EventHandler _recorderNotified; - private Native.NotifiedCallback _notifiedCallback; - /// - /// Occurred when error is occured. - /// - private EventHandler _recordingErrorOccurred; - private Native.RecorderErrorCallback _recorderErrorCallback; - private List _formats; - private List _audioCodec; - private List _videoCodec; - private List _resolutions; - StreamRecorderVideoResolution _videoResolution = null; + private bool _audioEnabled; + private bool _videoEnabled; + private StreamRecorderVideoFormat _sourceFormat; /// - /// Stream recorder constructor. + /// Initialize a new instance of the class. /// + /// The feature is not supported. public StreamRecorder() { - int ret = Native.Create(out _handle); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to create stream recorder"); - } - _formats = new List(); - _audioCodec = new List(); - _videoCodec = new List(); - _resolutions = new List(); - _videoResolution = new StreamRecorderVideoResolution(_handle); - } - - /// - /// Stream recorder destructor. - /// - ~StreamRecorder() - { - Dispose(false); - } - - /// - /// Event that occurs when streamrecorder state is changed. - /// - public event EventHandler RecorderNotified - { - add - { - if (_recorderNotified == null) - { - RegisterStreamRecorderNotifiedEvent(); - } - _recorderNotified += value; - } - remove - { - _recorderNotified -= value; - if (_recorderNotified == null) - { - UnregisterStreamRecorderNotifiedEvent(); - } - } - } - - /// - /// Event that occurs when buffer had comsumed completely. - /// - public event EventHandler BufferConsumed - { - add + try { - if (_bufferConsumed == null) - { - RegisterBufferComsumedEvent(); - } - _bufferConsumed += value; + Native.Create(out _handle).ThrowIfError("Failed to create stream recorder."); } - remove + catch (TypeLoadException) { - _bufferConsumed -= value; - if (_bufferConsumed == null) - { - UnregisterBufferComsumedEvent(); - } - } - } - - /// - /// Event that occurs when recording status changed. - /// - public event EventHandler RecordingStatusChanged - { - add - { - if (_recordingStatusChanged == null) - { - RegisterRecordingStatusChangedEvent(); - } - _recordingStatusChanged += value; - } - remove - { - _recordingStatusChanged -= value; - if (_recordingStatusChanged == null) - { - UnregisterRecordingStatusChangedEvent(); - } + throw new NotSupportedException("StreamRecorder is not supported."); } - } - /// - /// Event that occurs when recording limit is reached. - /// - public event EventHandler RecordingLimitReached - { - add - { - if (_recordingLimitReached == null) - { - RegisterRecordingLimitReachedEvent(); - } - _recordingLimitReached += value; - } - remove - { - _recordingLimitReached -= value; - if (_recordingLimitReached == null) - { - UnregisterRecordingLimitReachedEvent(); - } - } - } + LoadCapabilities(); - /// - /// Event that occurs when an error occured during recorder operation. - /// - public event EventHandler RecordingErrorOccurred - { - add - { - if (_recordingErrorOccurred == null) - { - RegisterRecordingErrorOccurredEvent(); - } - _recordingErrorOccurred += value; - } - remove - { - _recordingErrorOccurred -= value; - if (_recordingErrorOccurred == null) - { - UnregisterRecordingErrorOccurredEvent(); - } - } + RegisterStreamRecorderNotifiedEvent(); + RegisterBufferConsumedEvent(); + RegisterRecordingStatusChangedEvent(); + RegisterRecordingErrorOccurredEvent(); + RegisterRecordingLimitReachedEvent(); } - /// - /// The file path to record. - /// - /// - /// If the same file already exists in the file system, then old file - /// will be overwritten. - /// - public string FilePath + internal NativeHandle Handle { get { - IntPtr val; - int ret = Native.GetFileName(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) + if (_disposed) { - Log.Error(StreamRecorderLog.Tag, "Failed to get filepath, " + (StreamRecorderError)ret); + throw new ObjectDisposedException(nameof(StreamRecorder)); } - string result = Marshal.PtrToStringAnsi(val); - LibcSupport.Free(val); - return result; - } - set - { - int ret = Native.SetFileName(_handle, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set filepath, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set filepath"); - } - } - } - - /// - /// Get the current state of the stream recorder. - /// - /// The current state of stream recorder. - public StreamRecorderState State - { - get - { - int val = 0; - int ret = Native.GetState(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get stream recorder state, " + (StreamRecorderError)ret); - } - return (StreamRecorderState)val; + return _handle; } } /// - /// Get/Set the file format for recording media stream. + /// Gets the current state of the stream recorder. /// - /// - /// Must set . - /// The recorder state must be state. - /// - /// The format does not valid. - /// - public StreamRecorderFileFormat FileFormat + /// The has already been disposed. + public RecorderState State { get { - int val = 0; - - int ret = Native.GetFileFormat(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get file format, " + (StreamRecorderError)ret); - } - return (StreamRecorderFileFormat)val; - } - set - { - int ret = Native.SetFileFormat(_handle, (int)value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set file format, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret); - } - } - } + Native.GetState(Handle, out var val).ThrowIfError("Failed to get the stream recorder state."); - /// - /// The audio codec for encoding an audio stream. - /// - /// - /// Must set or - /// by - /// - /// The codec does not valid. - /// - public StreamRecorderAudioCodec AudioCodec - { - get - { - int val = 0; - - int ret = Native.GetAudioEncoder(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get audio codec, " + (StreamRecorderError)ret); - } - return (StreamRecorderAudioCodec)val; - } - set - { - int ret = Native.SetAudioEncoder(_handle, (int)value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set audio codec, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret); - } - } - } - - /// - /// The video codec for encoding video stream. - /// - /// - /// Must set or - /// by - /// - /// The codec does not valid. - /// - public StreamRecorderVideoCodec VideoCodec - { - get - { - int val = 0; - - int ret = Native.GetVideoEncoder(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get video codec, " + (StreamRecorderError)ret); - } - return (StreamRecorderVideoCodec)val; - } - set - { - int ret = Native.SetVideoEncoder(_handle, (int)value); - - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set video codec, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret); - } - } - } - - /// - /// The maximum size of a recording file in KB(kilobytes). If 0, means - /// unlimited recording size. - /// - /// - /// After reaching the limitation, the data which is being recorded will - /// be discarded and not written to the file. - /// The recorder state must be state. - /// - /// The value set to below 0. - /// - public int SizeLimit - { - get - { - int val = 0; - - int ret = Native.GetRecordingLimit(_handle, 1, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get size limit, " + (StreamRecorderError)ret); - } return val; } - set - { - int ret = Native.SetRecordingLimit(_handle, 1, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set sizelimit, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set size limit"); - } - } } - /// - /// The time limit of a recording file in Seconds. If 0, means unlimited recording - /// time. - /// - /// - /// After reaching the limitation, the data which is being recorded will - /// be discarded and not written to the file. - /// The recorder state must be state. - /// - /// The value set to below 0. - /// - public int TimeLimit + private void ValidateState(params RecorderState[] required) { - get - { - int val = 0; + Debug.Assert(required.Length > 0); - int ret = Native.GetRecordingLimit(_handle, 0, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get time limit, " + (StreamRecorderError)ret); - } - return val; - } - set + var curState = State; + if (!required.Contains(curState)) { - int ret = Native.SetRecordingLimit(_handle, 0, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set timelimit, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set time limit"); - } + throw new InvalidOperationException($"The stream recorder is not in a valid state. " + + $"Current State : { curState }, Valid State : { string.Join(", ", required) }."); } } + #region Operation methods /// - /// The sampling rate of an audio stream in hertz. + /// Prepares the stream recorder with the specified options. /// - /// - /// The recorder state must be state. - /// Must set or - /// by . - /// - /// The value set to below 0. - public int AudioSampleRate - { - get - { - int val = 0; - - int ret = Native.GetAudioSampleRate(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get audio samplerate, " + (StreamRecorderError)ret); - } - return val; - } - set - { - int ret = Native.SetAudioSampleRate(_handle, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set audio samplerate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio samplerate"); - } - } - } - - /// - /// The bitrate of an audio encoder in bits per second. - /// - /// - /// The recorder state must be state. - /// Must set or - /// by - /// - /// The value set to below 0. - public int AudioBitRate - { - get - { - int val = 0; - - int ret = Native.GetAudioEncoderBitrate(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get audio bitrate, " + (StreamRecorderError)ret); - } - return val; - } - set - { - int ret = Native.SetAudioEncoderBitrate(_handle, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set audio bitrate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio bitrate"); - } - } - } - - /// - /// The bitrate of an video encoder in bits per second. - /// - /// - /// The recorder state must be state. - /// Must set or - /// by - /// - /// The value set to below 0. - public int VideoBitRate - { - get - { - int val = 0; - - int ret = Native.GetVideoEncoderBitrate(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get video bitrate, " + (StreamRecorderError)ret); - } - return val; - } - set - { - int ret = Native.SetVideoEncoderBitrate(_handle, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set video bitrate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set video bitrate"); - } - } - } - - /// - /// The video frame rate for recording media stream. - /// - /// - /// The recorder state must be state. - /// Must set or - /// by - /// - /// The value set to below 0. - public int VideoFrameRate - { - get - { - int val = 0; - - int ret = Native.GetVideoFramerate(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get video framerate, " + (StreamRecorderError)ret); - } - return val; - } - set - { - int ret = Native.SetVideoFramerate(_handle, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set video framerate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret); - } - } - } - - /// - /// Get or Set the video source format for recording media stream. - /// - /// The value set to a invalid value. - /// - public StreamRecorderVideoSourceFormat VideoSourceFormat - { - get - { - int val = 0; - - int ret = Native.GetVideoSourceFormat(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get video framerate, " + (StreamRecorderError)ret); - } - return (StreamRecorderVideoSourceFormat)val; - } - set - { - int ret = Native.SetVideoSourceFormat(_handle, (int)value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set video framerate, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret); - } - } - } - - /// - /// The number of audio channel. - /// - /// - /// The attribute is applied only in Created state. - /// For mono recording, set channel to 1. - /// For stereo recording, set channel to 2. - /// The recorder state must be state. - /// - /// The value set to a invalid value. - public int AudioChannel - { - get - { - int val = 0; - - int ret = Native.GetAudioChannel(_handle, out val); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to get audio channel, " + (StreamRecorderError)ret); - } - return val; - } - set - { - int ret = Native.SetAudioChannel(_handle, value); - if ((StreamRecorderError)ret != StreamRecorderError.None) - { - Log.Error(StreamRecorderLog.Tag, "Failed to set audio channel, " + (StreamRecorderError)ret); - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio channel"); - } - } - } - - /// - /// Video resolution of the video recording. - /// - /// - /// Must set or - /// by - /// The recorder state must be state. - /// - /// The value set to a invalid value. - /// - public StreamRecorderVideoResolution Resolution + /// The recorder must be . + /// The options for recording. + /// The recorder is not in the valid state. + /// Both and + /// are null. + /// + /// contains a value which is not supported. + /// The has already been disposed. + /// + /// + /// + /// + /// + public void Prepare(StreamRecorderOptions options) { - get + if (options == null) { - return _videoResolution; + throw new ArgumentNullException(nameof(options)); } - } - /// - /// Retrieves all the file formats supported by the stream recorder. - /// - /// - /// It returns a list containing all the supported file - /// formats by Stream recorder. - /// - /// - public IEnumerable SupportedFileFormats - { - get - { - if (_formats.Count == 0) - { - Native.FileFormatCallback callback = (StreamRecorderFileFormat format, IntPtr userData) => - { - _formats.Add(format); - return true; - }; - int ret = Native.FileFormats(_handle, callback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported fileformats"); - } - } - return _formats; - } - } + ValidateState(RecorderState.Idle); - /// - /// Retrieves all the audio encoders supported by the recorder. - /// - /// - /// It returns a list containing all the supported audio encoders - /// by recorder. - /// - /// - public IEnumerable SupportedAudioEncodings - { - get - { - if (_audioCodec.Count == 0) - { - Native.AudioEncoderCallback callback = (StreamRecorderAudioCodec codec, IntPtr userData) => - { - _audioCodec.Add(codec); - return true; - }; - int ret = Native.AudioEncoders(_handle, callback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported audio encoders"); - } - } - return _audioCodec; - } - } + options.Apply(this); - /// - /// Retrieves all the video encoders supported by the recorder. - /// - /// - /// It returns a list containing all the supported video encoders - /// by recorder. - /// - /// - public IEnumerable SupportedVideoEncodings - { - get - { - if (_videoCodec.Count == 0) - { - Native.VideoEncoderCallback callback = (StreamRecorderVideoCodec codec, IntPtr userData) => - { - _videoCodec.Add(codec); - return true; - }; - int ret = Native.VideoEncoders(_handle, callback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported video encoders"); - } - } - return _videoCodec; - } - } + Native.Prepare(Handle).ThrowIfError("Failed to prepare stream recorder."); - /// - /// Retrieves all the video resolutions supported by the recorder. - /// - /// - /// It returns videoresolution list containing the width and height of - /// different resolutions supported by recorder. - /// - /// - public IEnumerable SupportedVideoResolutions - { - get - { - if (_resolutions.Count == 0) - { - Native.VideoResolutionCallback callback = (int width, int height, IntPtr userData) => - { - StreamRecorderVideoResolution temp = new StreamRecorderVideoResolution(width, height); - _resolutions.Add(temp); - return true; - }; - int ret = Native.VideoResolution(_handle, callback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported video resolutions"); - } - } - return _resolutions; - } - } + _audioEnabled = options.Audio != null; + _videoEnabled = options.Video != null; - /// - /// Prepare the stream recorder. - /// - /// - /// Before calling the function, it is required to set , - /// , and properties of recorder. - /// - /// The streamrecorder is not in the valid state. - /// - public void Prepare() - { - int ret = Native.Prepare(_handle); - if (ret != (int)StreamRecorderError.None) + if (options.Video != null) { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to prepare stream recorder"); + _sourceFormat = options.Video.SourceFormat; } } /// - /// Resets the stream recorder. + /// Unprepares the stream recorder. /// /// - /// The recorder state must be state by , and . - /// The StreamRecorder state will be . + /// The recorder state must be state by + /// , and .\n + /// The recorder state will be .\n + /// \n + /// It has no effect if the recorder is already in the state. /// - /// The streamrecorder is not in the valid state. + /// The recorder is not in the valid state. + /// The has already been disposed. /// public void Unprepare() { - int ret = Native.Unprepare(_handle); - if (ret != (int)StreamRecorderError.None) + if (State == RecorderState.Idle) { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to reset the stream recorder"); + return; } + + ValidateState(RecorderState.Ready); + + Native.Unprepare(Handle).ThrowIfError("Failed to reset the stream recorder."); } /// - /// Starts the recording. + /// Starts recording. /// /// - /// If file path has been set to an existing file, this file is removed automatically and updated by new one. - /// The filename should be set before this function is invoked. - /// The recorder state must be state by or - /// state by . - /// The filename shuild be set by + /// The recorder state must be state by + /// or + /// state by .\n + /// \n + /// It has no effect if the recorder is already in the state. /// - /// The streamrecorder is not in the valid state. - /// The access ot the resources can not be granted. + /// The recorder is not in the valid state. + /// The access of the resources can not be granted. + /// The has already been disposed. /// /// /// - /// - /// public void Start() { - int ret = Native.Start(_handle); - if (ret != (int)StreamRecorderError.None) + if (State == RecorderState.Recording) { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to start the stream recorder"); + return; } + + ValidateState(RecorderState.Ready, RecorderState.Paused); + + Native.Start(Handle).ThrowIfError("Failed to start the stream recorder."); } /// - /// Pause the recording. + /// Pauses recording. /// /// - /// Recording can be resumed with . + /// Recording can be resumed with .\n + /// \n + /// The recorder state must be state by \n + /// \n + /// It has no effect if the recorder is already in the state. /// - /// The streamrecorder is not in the valid state. + /// The recorder is not in the valid state. + /// The has already been disposed. /// /// /// public void Pause() { - int ret = Native.Pause(_handle); - if (ret != (int)StreamRecorderError.None) + if (State == RecorderState.Paused) { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to pause the stream recorder"); + return; } + + ValidateState(RecorderState.Recording); + + Native.Pause(Handle).ThrowIfError("Failed to pause the stream recorder."); } /// /// Stops recording and saves the result. /// /// - /// The recorder state must be state by or - /// state by - /// When you want to record audio or video file, you need to add privilege according to rules below additionally. + /// The recorder state must be state by or + /// state by .\n + /// \n + /// The recorder state will be after commit.\n /// - /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. - /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. + /// http://tizen.org/privilege/mediastorage is needed if the save path are relevant to media storage. + /// http://tizen.org/privilege/externalstorage is needed if the save path are relevant to external storage. /// /// - /// The streamrecorder is not in the valid state. - /// The access ot the resources can not be granted. + /// http://tizen.org/privilege/mediastorage + /// http://tizen.org/privilege/externalstorage + /// The recorder is not in the valid state. + /// The access to the resources can not be granted. + /// The has already been disposed. /// /// public void Commit() { - int ret = Native.Commit(_handle); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to save the recorded content"); - } + ValidateState(RecorderState.Paused, RecorderState.Recording); + + Native.Commit(Handle).ThrowIfError("Failed to commit."); } /// - /// Cancels the recording. - /// The recording data is discarded and not written in the recording file. + /// Cancels recording. + /// The recording data is discarded and not written. /// + /// + /// The recorder state must be state by or + /// state by . + /// + /// The recorder is not in the valid state. + /// The has already been disposed. /// /// public void Cancel() { - int ret = Native.Cancel(_handle); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to cancel the recording"); - } - } - - /// - /// Push stream buffer as recording raw data. - /// - public void PushBuffer(MediaPacket packet) - { - IntPtr _packet_h = packet.GetHandle(); + ValidateState(RecorderState.Paused, RecorderState.Recording); - Log.Info("Tizen.Multimedia.StreamRecorder", "PUSH stream buffer"); - int ret = Native.PushStreamBuffer(_handle, _packet_h); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to push buffer"); - } - Log.Info("Tizen.Multimedia.StreamRecorder", "PUSH stream buffer END"); + Native.Cancel(Handle).ThrowIfError("Failed to cancel recording."); } - /// - /// Set the source type of pushed data. - /// - public void EnableSourceBuffer(StreamRecorderSourceType type) + private static bool AreVideoTypesMatched(StreamRecorderVideoFormat videoFormat, MediaFormatVideoMimeType mimeType) { - int ret = Native.EnableSourceBuffer(_handle, (int)type); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Failed to set EnableSourceBuffer"); - } + return (videoFormat == StreamRecorderVideoFormat.Nv12 && mimeType == MediaFormatVideoMimeType.NV12) || + (videoFormat == StreamRecorderVideoFormat.Nv21 && mimeType == MediaFormatVideoMimeType.NV21) || + (videoFormat == StreamRecorderVideoFormat.I420 && mimeType == MediaFormatVideoMimeType.I420); } /// - /// Release any unmanaged resources used by this object. + /// Pushes a packet as recording raw data. /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) + /// An audio or video packet to record. + /// + /// The recorder state must be state by . + /// + /// + /// The recorder is not in the valid state.\n + /// -or-\n + /// is an audio packet but audio recording is not enabled(See ).\n + /// -or-\n + /// is a video packet but video recording is not enabled(See ).\n + /// -or-\n + /// is a video packet but the does not match the video source format.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + /// + /// + /// + /// + public void PushBuffer(MediaPacket packet) { - if (!_disposed) + if (packet == null) { - if (disposing) - { - // to be used if there are any other disposable objects - } - if (_handle != IntPtr.Zero) - { - Native.Destroy(_handle); - _handle = IntPtr.Zero; - } - _disposed = true; + throw new ArgumentNullException(nameof(packet)); } - } - private void RegisterStreamRecorderNotifiedEvent() - { - _notifiedCallback = (StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notify, IntPtr userData) => - { - StreamRecorderNotifiedEventArgs eventArgs = new StreamRecorderNotifiedEventArgs(previous, current, notify); - _recorderNotified?.Invoke(this, eventArgs); - }; - int ret = Native.SetNotifiedCallback(_handle, _notifiedCallback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Setting notify callback failed"); - } - } + ValidateState(RecorderState.Recording); - private void UnregisterStreamRecorderNotifiedEvent() - { - int ret = Native.UnsetNotifiedCallback(_handle); - if (ret != (int)StreamRecorderError.None) + switch (packet.Format.Type) { - StreamRecorderErrorFactory.ThrowException(ret, "Unsetting notify callback failed"); - } - } + case MediaFormatType.Audio: + if (_audioEnabled == false) + { + throw new InvalidOperationException("Audio option is not set."); + } + break; - private void RegisterBufferComsumedEvent() - { - _bufferConsumedCallback = (IntPtr buffer, IntPtr userData) => - { - StreamRecordingBufferConsumedEventArgs eventArgs = new StreamRecordingBufferConsumedEventArgs(buffer); - _bufferConsumed?.Invoke(this, eventArgs); - }; - int ret = Native.SetBufferConsumedCallback(_handle, _bufferConsumedCallback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Setting buffer consumed callback failed"); - } - } + case MediaFormatType.Video: + if (_videoEnabled == false) + { + throw new InvalidOperationException("Video option is not set."); + } - private void UnregisterBufferComsumedEvent() - { - int ret = Native.UnsetBufferConsumedCallback(_handle); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Unsetting buffer consumed callback failed"); - } - } + if (AreVideoTypesMatched(_sourceFormat, (packet.Format as VideoMediaFormat).MimeType) == false) + { + throw new InvalidOperationException("Video format does not match."); + } - private void RegisterRecordingStatusChangedEvent() - { - _recordingStatusCallback = (ulong elapsedTime, ulong fileSize, IntPtr userData) => - { - RecordingStatusChangedEventArgs eventArgs = new RecordingStatusChangedEventArgs((long)elapsedTime, (long)fileSize); - _recordingStatusChanged?.Invoke(this, eventArgs); - }; - int ret = Native.SetStatusChangedCallback(_handle, _recordingStatusCallback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Setting status changed callback failed"); - } - } + break; - private void UnregisterRecordingStatusChangedEvent() - { - int ret = Native.UnsetStatusChangedCallback(_handle); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Unsetting status changed callback failed"); + default: + throw new ArgumentException("Packet is not valid."); } - } - private void RegisterRecordingLimitReachedEvent() - { - _recordingLimitReachedCallback = (StreamRecordingLimitType type, IntPtr userData) => - { - StreamRecordingLimitReachedEventArgs eventArgs = new StreamRecordingLimitReachedEventArgs(type); - _recordingLimitReached?.Invoke(this, eventArgs); - }; - int ret = Native.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Setting limit reached callback failed"); - } + Native.PushStreamBuffer(Handle, MediaPacket.Lock.Get(packet).GetHandle()) + .ThrowIfError("Failed to push buffer."); } - private void UnregisterRecordingLimitReachedEvent() - { - int ret = Native.UnsetLimitReachedCallback(_handle); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Unsetting limit reached callback failed"); - } - } + #endregion - private void RegisterRecordingErrorOccurredEvent() + #region Dispose support + /// + /// Release any unmanaged resources used by this object. + /// + public void Dispose() { - _recorderErrorCallback = (StreamRecorderErrorCode error, StreamRecorderState current, IntPtr userData) => - { - StreamRecordingErrorOccurredEventArgs eventArgs = new StreamRecordingErrorOccurredEventArgs(error, current); - _recordingErrorOccurred?.Invoke(this, eventArgs); - }; - int ret = Native.SetErrorCallback(_handle, _recorderErrorCallback, IntPtr.Zero); - if (ret != (int)StreamRecorderError.None) - { - StreamRecorderErrorFactory.ThrowException(ret, "Setting Error callback failed"); - } + Dispose(true); } - private void UnregisterRecordingErrorOccurredEvent() + /// + /// Releases the resources used by the StreamRecorder. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) { - int ret = Native.UnsetErrorCallback(_handle); - if (ret != (int)StreamRecorderError.None) + if (!_disposed) { - StreamRecorderErrorFactory.ThrowException(ret, "Unsetting Error callback failed"); + _handle?.Dispose(); + + _disposed = true; } } + #endregion } } diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderAudioOptions.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderAudioOptions.cs new file mode 100644 index 0000000..911cf34 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderAudioOptions.cs @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Native = Interop.StreamRecorder; + +namespace Tizen.Multimedia +{ + /// + /// Specifies the options associated with audio recording. + /// + /// + /// + /// + public class StreamRecorderAudioOptions + { + private const int DefaultSampleRate = 0; + private const int DefaultBitRate = 128000; + private const int DefaultChannels = 2; + + /// + /// Initialize a new instance of the class with the specified codec. + /// + /// The for encoding audio stream. + /// + /// , and will be set as default. + /// + /// is not valid. + public StreamRecorderAudioOptions(RecorderAudioCodec codec) : + this(codec, DefaultSampleRate, DefaultBitRate, DefaultChannels) + { + } + + /// + /// Initialize a new instance of the class with the specified + /// codec, sample rate, bit rate and channel value. + /// + /// The for encoding audio stream. + /// The sample rate for encoding audio stream. + /// The bit rate for encoding audio stream. + /// The number of channels for encoding audio stream. + /// is not valid. + /// + /// is less than zero.\n + /// -or-\n + /// is less than or equal to zero.\n + /// -or-\n + /// is less than or equal to zero. + /// + public StreamRecorderAudioOptions(RecorderAudioCodec codec, int sampleRate, int bitRate, int channels) + { + Codec = codec; + SampleRate = sampleRate; + BitRate = bitRate; + Channels = channels; + } + + private RecorderAudioCodec _codec; + + /// + /// Gets or sets the audio codec for encoding an audio stream. + /// + /// The codec for audio stream recording. + /// is not valid. + /// + public RecorderAudioCodec Codec + { + get => _codec; + set + { + ValidationUtil.ValidateEnum(typeof(RecorderAudioCodec), value, nameof(value)); + + _codec = value; + } + } + + private int _sampleRate; + + /// + /// Gets or sets the sampling rate of the audio stream in hertz. + /// + /// If the value is zero, the sample rate will be decided based on input buffers. + /// The sample rate value for stream recorder. The default is zero. + /// is less than zero. + public int SampleRate + { + get => _sampleRate; + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Sample rate can't be less than or equal to zero."); + } + + _sampleRate = value; + } + } + + private int _bitRate; + + /// + /// Gets or sets the bit rate of the audio encoder in bits per second. + /// + /// The bit rate value for audio stream recording. The default is 128000. + /// is less than or equal to zero. + public int BitRate + { + get => _bitRate; + set + { + if (value <= 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Bit rate can't be less than or equal to zero."); + } + + _bitRate = value; + } + } + + private int _channels; + + /// + /// Gets or sets the number of audio channels. + /// + /// The number of audio channels for audio stream recording. The default is 2. + /// is less than or equal to zero. + public int Channels + { + get => _channels; + set + { + if (value <= 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Channels can't be less than or equal to zero."); + } + + _channels = value; + } + } + + internal void Apply(StreamRecorder recorder) + { + recorder.ValidateAudioCodec(Codec); + + Native.SetAudioEncoder(recorder.Handle, Codec.ToStreamRecorderEnum()). + ThrowIfError("Failed to set audio codec."); + + Native.SetAudioSampleRate(recorder.Handle, SampleRate). + ThrowIfError("Failed to set audio sample rate."); + + Native.SetAudioEncoderBitrate(recorder.Handle, BitRate). + ThrowIfError("Failed to set audio bit rate."); + + Native.SetAudioChannel(recorder.Handle, Channels). + ThrowIfError("Failed to set audio channels."); + } + } + +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderBufferConsumedEventArgs.cs similarity index 67% rename from src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderBufferConsumedEventArgs.cs index 3628849..f11c51c 100644 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderBufferConsumedEventArgs.cs @@ -18,25 +18,20 @@ using System; namespace Tizen.Multimedia { + /// - /// An extended EventArgs. + /// Provides data for the event. /// - public class StreamRecordingBufferConsumedEventArgs : EventArgs + public class StreamRecorderBufferConsumedEventArgs : EventArgs { - private IntPtr _buffer = IntPtr.Zero; - - internal StreamRecordingBufferConsumedEventArgs(IntPtr buffer) + internal StreamRecorderBufferConsumedEventArgs(MediaPacket packet) { - _buffer = buffer; + Packet = packet; } /// - /// Consumed buffer. + /// Gets the packet that has consumed. /// - public IntPtr Buffer { - get { - return _buffer; - } - } + public MediaPacket Packet { get; } } } diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs index 58b6511..041d0f0 100644 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs @@ -14,12 +14,52 @@ * limitations under the License. */ +using System; +using System.Diagnostics; + namespace Tizen.Multimedia { + + /// + /// Specifies errors for / + /// + public enum StreamRecorderError + { + /// + /// Internal error. + /// + InternalError = StreamRecorderErrorCode.InvalidOperation, + /// + /// Out of storage. + /// + OutOfStorage = StreamRecorderErrorCode.OutOfStorage + } + + /// + /// Specifies the video source formats for . + /// + public enum StreamRecorderVideoFormat + { + /// + /// Nv12 format. + /// + Nv12, + /// + /// Nv21 format. + /// + Nv21, + /// + /// I420 format. + /// + I420 + } + + #region Internal enums + /// /// Enumeration for Audio Codec. /// - public enum StreamRecorderAudioCodec + internal enum StreamRecorderAudioCodec { /// /// AMR codec. @@ -38,7 +78,7 @@ namespace Tizen.Multimedia /// /// Enumeration for the file container format. /// - public enum StreamRecorderFileFormat + internal enum StreamRecorderFileFormat { /// /// 3GP file format. @@ -65,64 +105,22 @@ namespace Tizen.Multimedia /// /// Enumeration for the recorder notify type. /// - public enum StreamRecorderNotify + internal enum StreamRecorderNotify { /// /// None. /// None = 0, /// - /// State changed noti. + /// State changed. /// StateChanged } /// - /// Enumeration for the recording limit type. - /// - public enum StreamRecordingLimitType - { - /// - /// Time limit in seconds of recording file - /// - Time, - /// - /// Size limit in KB(KiloBytes) of recording file. - /// - Size - } - - /// - /// Enumeration for stream recorder states. - /// - public enum StreamRecorderState - { - /// - /// Stream recorder is not created. - /// - None, - /// - /// Stream recorder is created, but not prepared. - /// - Created, - /// - /// Stream recorder is ready to record. - /// - Prepared, - /// - /// Stream recorder is recording pushed packet. - /// - Recording, - /// - /// Stream recorder is paused. - /// - Paused - } - - /// /// Enumeration for video codec. /// - public enum StreamRecorderVideoCodec + internal enum StreamRecorderVideoCodec { /// /// H263 codec. @@ -137,7 +135,7 @@ namespace Tizen.Multimedia /// /// Enumeration for source type. /// - public enum StreamRecorderSourceType + internal enum StreamRecorderSourceType { /// /// Video source @@ -153,45 +151,122 @@ namespace Tizen.Multimedia VideoAudio } - /// - /// Enumeration for video source format. - /// - public enum StreamRecorderVideoSourceFormat + internal static class StreamRecorderEnumExtensions { - /// - /// Nv12 Video source format - /// - Nv12, - /// - /// Nv21 video source format - /// - Nv21, - /// - /// I420 video source format - /// - I420 - } + internal static RecorderVideoCodec ToRecorderEnum(this StreamRecorderVideoCodec value) + { + switch (value) + { + case StreamRecorderVideoCodec.H263: + return RecorderVideoCodec.H263; - /// - /// Enumeration for stream recorder failure error. - /// - public enum StreamRecorderErrorCode - { - /// - /// Sucessful. - /// - None = StreamRecorderError.None, - /// - /// Internal error. - /// - InvalidParameter = StreamRecorderError.InvalidParameter, - /// - /// Internal error. - /// - InvalidOperation = StreamRecorderError.InvalidOperation, - /// - /// Out of memory. - /// - OutOfMemory = StreamRecorderError.OutOfMemory + case StreamRecorderVideoCodec.Mpeg4: + return RecorderVideoCodec.Mpeg4; + } + + Debug.Fail("Unknown video codec value."); + return 0; + } + + internal static StreamRecorderVideoCodec ToStreamRecorderEnum(this RecorderVideoCodec value) + { + switch (value) + { + case RecorderVideoCodec.H263: + return StreamRecorderVideoCodec.H263; + + case RecorderVideoCodec.Mpeg4: + return StreamRecorderVideoCodec.Mpeg4; + } + + throw new NotSupportedException($"{value.ToString()} is not supported."); + } + + + internal static RecorderAudioCodec ToRecorderEnum(this StreamRecorderAudioCodec value) + { + switch (value) + { + case StreamRecorderAudioCodec.Aac: + return RecorderAudioCodec.Aac; + + case StreamRecorderAudioCodec.Amr: + return RecorderAudioCodec.Amr; + + case StreamRecorderAudioCodec.Pcm: + return RecorderAudioCodec.Pcm; + } + + Debug.Fail("Unknown audio codec value."); + return 0; + } + + + internal static StreamRecorderAudioCodec ToStreamRecorderEnum(this RecorderAudioCodec value) + { + switch (value) + { + case RecorderAudioCodec.Aac: + return StreamRecorderAudioCodec.Aac; + + case RecorderAudioCodec.Amr: + return StreamRecorderAudioCodec.Amr; + + case RecorderAudioCodec.Pcm: + return StreamRecorderAudioCodec.Pcm; + } + + throw new NotSupportedException($"{value.ToString()} is not supported."); + } + + + internal static RecorderFileFormat ToRecorderEnum(this StreamRecorderFileFormat value) + { + switch (value) + { + case StreamRecorderFileFormat.ThreeGp: + return RecorderFileFormat.ThreeGp; + + case StreamRecorderFileFormat.Mp4: + return RecorderFileFormat.Mp4; + + case StreamRecorderFileFormat.Amr: + return RecorderFileFormat.Amr; + + case StreamRecorderFileFormat.Adts: + return RecorderFileFormat.Adts; + + case StreamRecorderFileFormat.Wav: + return RecorderFileFormat.Wav; + } + + Debug.Fail("Unknown file format value."); + return 0; + } + + + internal static StreamRecorderFileFormat ToStreamRecorderEnum(this RecorderFileFormat value) + { + switch (value) + { + case RecorderFileFormat.ThreeGp: + return StreamRecorderFileFormat.ThreeGp; + + case RecorderFileFormat.Mp4: + return StreamRecorderFileFormat.Mp4; + + case RecorderFileFormat.Amr: + return StreamRecorderFileFormat.Amr; + + case RecorderFileFormat.Adts: + return StreamRecorderFileFormat.Adts; + + case RecorderFileFormat.Wav: + return StreamRecorderFileFormat.Wav; + } + + throw new NotSupportedException($"{value.ToString()} is not supported."); + } } + #endregion } diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderError.cs similarity index 58% rename from src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderError.cs index 4cd95da..3c971de 100644 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderError.cs @@ -15,11 +15,12 @@ */ using System; +using System.IO; using Tizen.Internals.Errors; namespace Tizen.Multimedia { - internal enum StreamRecorderError + internal enum StreamRecorderErrorCode { None = ErrorCode.None, InvalidParameter = ErrorCode.InvalidParameter, @@ -32,29 +33,40 @@ namespace Tizen.Multimedia NotSupported = ErrorCode.NotSupported, } - internal static class StreamRecorderErrorFactory + internal static class StreamRecorderErrorExtensions { - internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null) + internal static StreamRecorderErrorCode Ignore(this StreamRecorderErrorCode errorCode, StreamRecorderErrorCode ignore) { - StreamRecorderError err = (StreamRecorderError)errorCode; - if (string.IsNullOrEmpty(errorMessage)) + return (ignore == errorCode) ? StreamRecorderErrorCode.None : errorCode; + } + + internal static void ThrowIfError(this StreamRecorderErrorCode err, string errorMessage) + { + if (err == StreamRecorderErrorCode.None) { - errorMessage = err.ToString(); + return; } - switch ((StreamRecorderError)errorCode) + + switch (err) { - case StreamRecorderError.InvalidParameter: - throw new ArgumentException(errorMessage, paramName); - case StreamRecorderError.OutOfMemory: + case StreamRecorderErrorCode.InvalidParameter: + throw new ArgumentException(errorMessage); + + case StreamRecorderErrorCode.OutOfMemory: throw new OutOfMemoryException(errorMessage); - case StreamRecorderError.PermissionDenied: + + case StreamRecorderErrorCode.PermissionDenied: throw new UnauthorizedAccessException(errorMessage); - case StreamRecorderError.NotSupported: + + case StreamRecorderErrorCode.NotSupported: throw new NotSupportedException(errorMessage); - case StreamRecorderError.InvalidState: - case StreamRecorderError.InvalidOperation: - case StreamRecorderError.OutOfStorage: + + case StreamRecorderErrorCode.InvalidState: + case StreamRecorderErrorCode.InvalidOperation: throw new InvalidOperationException(errorMessage); + + case StreamRecorderErrorCode.OutOfStorage: + throw new IOException(errorMessage); } } } diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorOccurredEventArgs.cs similarity index 60% rename from src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorOccurredEventArgs.cs index 9b12fdc..228dda7 100644 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorOccurredEventArgs.cs @@ -19,24 +19,25 @@ using System; namespace Tizen.Multimedia { /// - /// An extended EventArgs class containing details about the recording limit. + /// Provides data for the event. /// - public class StreamRecordingLimitReachedEventArgs : EventArgs + public class StreamRecorderErrorOccurredEventArgs : EventArgs { - private StreamRecordingLimitType _type = StreamRecordingLimitType.Size; - - internal StreamRecordingLimitReachedEventArgs(StreamRecordingLimitType type) + internal StreamRecorderErrorOccurredEventArgs(StreamRecorderError error, RecorderState state) { - _type = type; + Error = error; + State = state; } /// - /// The limitation type. + /// Gets the error code. /// - public StreamRecordingLimitType Type { - get { - return _type; - } - } + public StreamRecorderError Error { get; } + + /// + /// Gets the state of the recorder. + /// + public RecorderState State { get; } + } } diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs deleted file mode 100644 index 0ac92f7..0000000 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Collections.Generic; - -namespace Tizen.Multimedia -{ - /// - /// An extended Eventargs class which contains interrupted policy details, previous and current - /// state of the recorder. - /// - public class StreamRecorderNotifiedEventArgs : EventArgs - { - private StreamRecorderState _previous = StreamRecorderState.None; - private StreamRecorderState _current = StreamRecorderState.None; - private StreamRecorderNotify _notify = StreamRecorderNotify.None; - - internal StreamRecorderNotifiedEventArgs(StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notify) - { - _previous = previous; - _current = current; - _notify = notify; - } - - /// - /// The previous state of the stream recorder. - /// - public StreamRecorderState Previous { - get { - return _previous; - } - } - - /// - /// The current state of the stream recorder. - /// - public StreamRecorderState Current { - get { - return _current; - } - } - - /// - /// The notify of the event. - /// - public StreamRecorderNotify Notify { - get { - return _notify; - } - } - } -} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderOptions.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderOptions.cs new file mode 100644 index 0000000..49d9098 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderOptions.cs @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using Native = Interop.StreamRecorder; + +namespace Tizen.Multimedia +{ + /// + /// Specifies the options associated with . + /// + /// + /// + /// + /// + public class StreamRecorderOptions + { + /// + /// Initialize a new instance of the class with the specified + /// save path and file format. + /// + /// The path that the recording result is saved. + /// The file format of output file. + /// is null. + /// + /// is an empty string.\n + /// -or-\n + /// is not valid. + /// + public StreamRecorderOptions(string savePath, RecorderFileFormat fileFormat) + { + SavePath = savePath; + FileFormat = fileFormat; + } + + private string _savePath; + + /// + /// Gets or sets the file path to record. + /// + /// + /// If the same file already exists in the file system, then old file will be overwritten. + /// + /// is null. + /// is an empty string. + public string SavePath + { + get => _savePath; + set + { + if (value == null) + { + throw new ArgumentNullException(nameof(value)); + } + + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Path can't be an empty string.", nameof(value)); + } + + _savePath = value; + } + } + + private RecorderFileFormat _fileFormat; + + /// + /// Gets or sets the file format for recording media stream. + /// + /// is not valid. + /// + public RecorderFileFormat FileFormat + { + get => _fileFormat; + set + { + ValidationUtil.ValidateEnum(typeof(RecorderFileFormat), value, nameof(value)); + + _fileFormat = value; + } + } + + private int _timeLimit; + + /// + /// Gets or sets the time limit of recording. + /// + /// + /// The maximum time of recording in seconds, or 0 for unlimited time. + /// + /// + /// After reaching the limitation, the data which is being recorded will + /// be discarded and not written to the file. + /// The recorder state must be state. + /// + /// is less than zero. + /// + /// + public int TimeLimit + { + get => _timeLimit; + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Time limit can't be less than zero."); + } + + _timeLimit = value; + } + } + + private int _sizeLimit; + + /// + /// Gets or sets the maximum size of a recording file. + /// + /// + /// The maximum size of a recording file in kilobytes, or 0 for unlimited size. + /// + /// + /// After reaching the limitation, the data which is being recorded will + /// be discarded and not written to the file. + /// + /// is less than zero. + /// + /// + public int SizeLimit + { + get => _sizeLimit; + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Size limit can't be less than zero."); + } + + _sizeLimit = value; + } + } + + /// + /// Gets or sets the options for audio recording. + /// + /// + /// or must be set for recording. + /// + /// + public StreamRecorderAudioOptions Audio { get; set; } + + /// + /// Gets or sets the options for video recording. + /// + /// + /// or must be set for recording. + /// + /// + public StreamRecorderVideoOptions Video { get; set; } + + private StreamRecorderSourceType GetSourceType() + { + Debug.Assert(Audio != null || Video != null); + + if (Audio != null && Video != null) + { + return StreamRecorderSourceType.VideoAudio; + } + + return Audio != null ? StreamRecorderSourceType.Audio : StreamRecorderSourceType.Video; + } + + internal void Apply(StreamRecorder recorder) + { + if (Audio == null && Video == null) + { + throw new ArgumentException("Both Audio and Video are not set."); + } + + Native.EnableSourceBuffer(recorder.Handle, GetSourceType()).ThrowIfError("Failed to apply options."); + + Native.SetFileName(recorder.Handle, SavePath).ThrowIfError("Failed to set save path."); + + recorder.ValidateFileFormat(FileFormat); + Native.SetFileFormat(recorder.Handle, FileFormat.ToStreamRecorderEnum()) + .ThrowIfError("Failed to set file format."); + + Native.SetRecordingLimit(recorder.Handle, RecordingLimitType.Size, SizeLimit). + ThrowIfError("Failed to set size limit."); + + Native.SetRecordingLimit(recorder.Handle, RecordingLimitType.Time, TimeLimit). + ThrowIfError("Failed to set time limit."); + + Audio?.Apply(recorder); + + Video?.Apply(recorder); + } + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderStateChangedEventArgs.cs similarity index 50% rename from src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs rename to src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderStateChangedEventArgs.cs index ea127b7..2a91d1a 100644 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderStateChangedEventArgs.cs @@ -19,37 +19,24 @@ using System; namespace Tizen.Multimedia { /// - /// An extended EventArgs class which contains details about error status and - /// state of the recorder when it failed. + /// Provides data for the event. /// - public class StreamRecordingErrorOccurredEventArgs : EventArgs + public class StreamRecorderStateChangedEventArgs : EventArgs { - private StreamRecorderErrorCode _error = StreamRecorderErrorCode.InvalidOperation; - private StreamRecorderState _state = StreamRecorderState.None; - - internal StreamRecordingErrorOccurredEventArgs(StreamRecorderErrorCode error, StreamRecorderState state) + internal StreamRecorderStateChangedEventArgs(RecorderState previous, RecorderState current) { - _error = error; - _state = state; + Previous = previous; + Current = current; } /// - /// The error code. + /// Gets the previous state of the stream recorder. /// - public StreamRecorderErrorCode Error { - get { - return _error; - } - } + public RecorderState Previous { get; } /// - /// The state of the recorder. + /// Gets the current state of the stream recorder. /// - public StreamRecorderState State { - get { - return _state; - } - } - + public RecorderState Current { get; } } } diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoOptions.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoOptions.cs new file mode 100644 index 0000000..3460532 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoOptions.cs @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Native = Interop.StreamRecorder; + +namespace Tizen.Multimedia +{ + /// + /// Specifies the options associated with video recording. + /// + /// + /// + /// + public class StreamRecorderVideoOptions + { + private const int DefaultBitRate = 0; + + /// + /// Initialize a new instance of the class with the specified + /// codec, resolution, source format and frame rate. + /// + /// The for encoding video stream. + /// The resolution of video recording. + /// The format of source stream. + /// The frame rate for encoding video stream. + /// + /// will be set as default. + /// + /// + /// is not valid.\n + /// -or-\n + /// is not valid.\n + /// + /// + /// Width or height of is less than or equal to zero.\n + /// -or-\n + /// is less than or equal to zero.\n + /// + public StreamRecorderVideoOptions(RecorderVideoCodec codec, Size resolution, + StreamRecorderVideoFormat sourceFormat, int frameRate) : + this(codec, resolution, sourceFormat, frameRate, DefaultBitRate) + { + } + + /// + /// Initialize a new instance of the class with the specified + /// codec, resolution, source format, frame rate and bit rate. + /// + /// The for encoding video stream. + /// The resolution of video recording. + /// The format of source stream. + /// The frame rate for encoding video stream. + /// The bit rate for encoding video stream. + /// + /// is not valid.\n + /// -or-\n + /// is not valid.\n + /// + /// + /// Width or height of is less than or equal to zero.\n + /// -or-\n + /// is less than or equal to zero.\n + /// -or-\n + /// is less than zero. + /// + public StreamRecorderVideoOptions(RecorderVideoCodec codec, Size resolution, + StreamRecorderVideoFormat sourceFormat, int frameRate, int bitRate) + { + Codec = codec; + Resolution = resolution; + SourceFormat = sourceFormat; + FrameRate = frameRate; + BitRate = bitRate; + } + + private RecorderVideoCodec _codec; + + /// + /// Gets or sets the video codec for encoding video stream. + /// + /// The codec for video stream recording. + /// is not valid. + /// + public RecorderVideoCodec Codec + { + get => _codec; + set + { + ValidationUtil.ValidateEnum(typeof(RecorderVideoCodec), value, nameof(value)); + + _codec = value; + } + } + + private Size _resolution; + + /// + /// Gets or sets the resolution of the video recording. + /// + /// The output resolution for video stream recording. + /// + /// Width or height of is less than or equal to zero. + /// + /// + public Size Resolution + { + get => _resolution; + set + { + if (value.Width <= 0 || value.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Resolution can't be less than or equal to zero."); + } + + _resolution = value; + } + } + + private int _frameRate; + + /// + /// Gets or sets the frame rate for recording media stream. + /// + /// The frame rate value for video stream recording. + /// is less than or equal to zero. + public int FrameRate + { + get => _frameRate; + set + { + if (value <= 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Frame rate can't be less than or equal to zero."); + } + _frameRate = value; + } + } + + private StreamRecorderVideoFormat _sourceFormat; + + /// + /// Gets or sets the video source format for recording media stream. + /// + /// The source format of buffers for video stream recording. + /// is not valid. + public StreamRecorderVideoFormat SourceFormat + { + get => _sourceFormat; + set + { + ValidationUtil.ValidateEnum(typeof(StreamRecorderVideoFormat), value, nameof(value)); + + _sourceFormat = value; + } + } + + private int _bitRate; + + /// + /// The bit rate of the video encoder in bits per second. + /// + /// The bit rate value for video stream recording. The default is 0. + /// is less than zero. + public int BitRate + { + get => _bitRate; + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + "Bit rate can't be less than or equal to zero."); + } + _bitRate = value; + } + } + + internal void Apply(StreamRecorder recorder) + { + recorder.ValidateVideoCodec(Codec); + + Native.SetVideoEncoder(recorder.Handle, Codec.ToStreamRecorderEnum()). + ThrowIfError("Failed to set video codec."); + + recorder.ValidateVideoResolution(Resolution); + + Native.SetVideoResolution(recorder.Handle, Resolution.Width, Resolution.Height). + ThrowIfError("Failed to set video resolution."); + + Native.SetVideoFrameRate(recorder.Handle, FrameRate). + ThrowIfError("Failed to set video frame rate."); + + Native.SetVideoEncoderBitRate(recorder.Handle, BitRate). + ThrowIfError("Failed to set video bit rate."); + + Native.SetVideoSourceFormat(recorder.Handle, SourceFormat). + ThrowIfError("Failed to set video source format."); + } + } + +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs deleted file mode 100644 index 8523098..0000000 --- a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using Native = Interop.StreamRecorder; - -namespace Tizen.Multimedia -{ - /// - /// Resolution for stream recorder. - /// - public class StreamRecorderVideoResolution - { - private int _width, _height; - private bool _interopFlag; - internal IntPtr _Handle; - - internal StreamRecorderVideoResolution(IntPtr handle) - { - _Handle = handle; - _interopFlag = true; - int ret = Native.GetVideoResolution(_Handle, out _width, out _height); - StreamRecorderError err = (StreamRecorderError)ret; - Log.Info(StreamRecorderLog.Tag, "width " + _width + " height " + _height + "return " + err.ToString()); - } - - internal StreamRecorderVideoResolution(int width, int height) - { - _interopFlag = false; - _width = width; - _height = height; - } - - /// - /// The video width. - /// - /// The width. - public int Width { - get { - if(_interopFlag == true) - Native.GetVideoResolution(_Handle, out _width, out _height); - return _width; - } - set { - _width = value; - if(_interopFlag == true) { - int ret = Native.SetVideoResolution(_Handle, _width, _height); - StreamRecorderError err = (StreamRecorderError)ret; - Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString()); - } - } - } - - /// - /// The video height. - /// - /// The height. - public int Height { - get { - if(_interopFlag == true) - Native.GetVideoResolution(_Handle, out _width, out _height); - return _height; - } - set { - _height = value; - if(_interopFlag == true) { - int ret = Native.SetVideoResolution(_Handle, _width, _height); - StreamRecorderError err = (StreamRecorderError)ret; - Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString()); - } - } - } - } -} diff --git a/src/Tizen.NUI/src/internal/AppSignalType.cs b/src/Tizen.NUI/src/internal/AppSignalType.cs new file mode 100755 index 0000000..2ff2a0a --- /dev/null +++ b/src/Tizen.NUI/src/internal/AppSignalType.cs @@ -0,0 +1,141 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AppSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AppSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AppSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AppSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_AppSignalType(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.AppSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.AppSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.AppSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.AppSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetApplication arg) + { + NDalicManualPINVOKE.AppSignalType_Emit(swigCPtr, WidgetApplication.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AppSignalType() : this(NDalicManualPINVOKE.new_AppSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Application.cs b/src/Tizen.NUI/src/internal/Application.cs index 91b60e4..ac6d54d 100755 --- a/src/Tizen.NUI/src/internal/Application.cs +++ b/src/Tizen.NUI/src/internal/Application.cs @@ -334,6 +334,61 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_applicationInitEventCallbackDelegate != null) + { + this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate); + } + + if (_applicationTerminateEventCallbackDelegate != null) + { + this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate); + } + + if (_applicationPauseEventCallbackDelegate != null) + { + this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate); + } + + if (_applicationResumeEventCallbackDelegate != null) + { + this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate); + } + + if (_applicationResetEventCallbackDelegate != null) + { + this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate); + } + + if (_applicationResizeEventCallbackDelegate != null) + { + this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate); + } + + if (_applicationLanguageChangedEventCallbackDelegate != null) + { + this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate); + } + + if (_applicationRegionChangedEventCallbackDelegate != null) + { + this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate); + } + + if (_applicationBatteryLowEventCallbackDelegate != null) + { + this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate); + } + + if (_applicationMemoryLowEventCallbackDelegate != null) + { + this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate); + } + + if (_applicationAppControlEventCallbackDelegate != null) + { + this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -1079,8 +1134,27 @@ namespace Tizen.NUI return ret; } - //Removed from v0.2.33 - /*public bool AddIdle(System.Delegate func) + + public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode) + { + NUILog.Debug(" NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode) is called! "); + + Application ret = New(args, stylesheet, (Application.WindowMode)windowMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + // we've got an application now connect the signals + ret.SetupDelegates(); + // set the singleton + _instance = ret; + return _instance; + } + + /// + /// Ensures that the function passed in is called from the main loop when it is idle. + /// + /// The function to call + /// true if added successfully, false otherwise + public bool AddIdle(System.Delegate func) { System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); System.IntPtr ip2 = NDalicManualPINVOKE.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip)); @@ -1089,9 +1163,7 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; - }*/ - - + } /** * Outer::outer_method(int) @@ -1132,6 +1204,17 @@ namespace Tizen.NUI return ret; } + public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode) + { + NUILog.Debug("New(string[] args) is called!"); + int argc = args.Length; + string argvStr = string.Join(" ", args); + + Application ret = new Application(NDalicPINVOKE.Application_New__MANUAL_4(argc, argvStr, stylesheet, (int)windowMode), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static Application New(int argc, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize) { Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_4(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true); diff --git a/src/Tizen.NUI/src/internal/FriendAssembly.cs b/src/Tizen.NUI/src/internal/FriendAssembly.cs index 585ec28..6ba2744 100755 --- a/src/Tizen.NUI/src/internal/FriendAssembly.cs +++ b/src/Tizen.NUI/src/internal/FriendAssembly.cs @@ -21,7 +21,7 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Tizen.NUI.Extension.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001004d7c7c03a196ecb8e7cc5056750e1f40ee2bbe99f0e53a07f2538f2b0f450bd731b9dca3706503a0378baca74a09cf3af6261b330c031f44817ab6ed64189460765a402279d3e0c1fa7295ae1dccb2e3ff329705fd85b58d66ae7cb7e95ba06e0d847c3e3ba918798f579e5caeb1c6149955e6baf24236eec46227a623e494b1")] -[assembly: InternalsVisibleTo("Tizen.Multimedia, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b1004248416b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693bddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] +[assembly: InternalsVisibleTo("Tizen.Multimedia, PublicKey=0024000004800000940000000602000000240000525341310004000001000100bd36a93b6d224759632d08a501b9dcb99a533e8ff0c3a1fc7044f5b05e176c005e5a7fc4d1dfa54da4d4cad4868c4518aa1f661380fb90685dc699d5e48dcc697b33c1e38b70845f405612d6827e7337c191ddd0a0aa35fdad654efe4c54881fdaa82ce35dce18ea918953e448c7aa284a47ed6fe3aa9404930b2b973a28cddf")] [assembly: InternalsVisibleTo("Tizen.TV.NUI, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed445c2a988d35b99e5766f42eef33d89d1f67225db051f011abcfce47a4788875c39750a2e5695f1ec117f41d96610419811762669f98131db30a6e64c6bb8fde3731f373f6cda4c0087d121f5108559f216dc015807dc46ec5a4d1b63f5deff64c01754a0db0dc849bc300672572cbd2697432ab6c193ebf9fade6bf0f2aad")] namespace Tizen.NUI diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs index ba61c57..e6870e6 100755 --- a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -795,6 +795,12 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_GetPosition")] public static extern global::System.IntPtr GetPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_FeedKeyEvent")] + public static extern void Window_FeedKeyEvent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_MakeCallback")] + public static extern global::System.IntPtr MakeCallback(global::System.Runtime.InteropServices.HandleRef jarg1); + //for widget view [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_WIDGET_ID_get")] public static extern int WidgetView_Property_WIDGET_ID_get(); @@ -926,6 +932,7 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_SWIGUpcast")] public static extern global::System.IntPtr WidgetViewManager_SWIGUpcast(global::System.IntPtr jarg1); + //For Adaptor [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_0")] public static extern global::System.IntPtr Adaptor_New__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); @@ -1039,5 +1046,254 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AdaptorSignalType")] public static extern void delete_AdaptorSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + //For widget + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_New")] + public static extern global::System.IntPtr Widget_New(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Widget__SWIG_0")] + public static extern global::System.IntPtr new_Widget__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Widget__SWIG_1")] + public static extern global::System.IntPtr new_Widget__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_Assign")] + public static extern global::System.IntPtr Widget_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Widget")] + public static extern void delete_Widget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_CreateSignal")] + public static extern global::System.IntPtr Widget_CreateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_TerminateSignal")] + public static extern global::System.IntPtr Widget_TerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_PauseSignal")] + public static extern global::System.IntPtr Widget_PauseSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_ResumeSignal")] + public static extern global::System.IntPtr Widget_ResumeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_ResizeSignal")] + public static extern global::System.IntPtr Widget_ResizeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_UpdateSignal")] + public static extern global::System.IntPtr Widget_UpdateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_New")] + public static extern global::System.IntPtr WidgetApplication_New(int jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetApplication__SWIG_0")] + public static extern global::System.IntPtr new_WidgetApplication__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetApplication__SWIG_1")] + public static extern global::System.IntPtr new_WidgetApplication__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_Assign")] + public static extern global::System.IntPtr WidgetApplication_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetApplication")] + public static extern void delete_WidgetApplication(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_MainLoop")] + public static extern void WidgetApplication_MainLoop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_Quit")] + public static extern void WidgetApplication_Quit(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_GetWindow")] + public static extern global::System.IntPtr WidgetApplication_GetWindow(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_GetResourcePath")] + public static extern string WidgetApplication_GetResourcePath(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_InitSignal")] + public static extern global::System.IntPtr WidgetApplication_InitSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_TerminateSignal")] + public static extern global::System.IntPtr WidgetApplication_TerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_LanguageChangedSignal")] + public static extern global::System.IntPtr WidgetApplication_LanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_RegionChangedSignal")] + public static extern global::System.IntPtr WidgetApplication_RegionChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_BatteryLowSignal")] + public static extern global::System.IntPtr WidgetApplication_BatteryLowSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_MemoryLowSignal")] + public static extern global::System.IntPtr WidgetApplication_MemoryLowSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_New")] + public static extern global::System.IntPtr WidgetData_New(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetData__SWIG_0")] + public static extern global::System.IntPtr new_WidgetData__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetData__SWIG_1")] + public static extern global::System.IntPtr new_WidgetData__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_Assign")] + public static extern global::System.IntPtr WidgetData_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetData")] + public static extern void delete_WidgetData(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_GetInstanceId")] + public static extern string WidgetData_GetInstanceId(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_GetArgs")] + public static extern global::System.IntPtr WidgetData_GetArgs(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_GetContent")] + public static extern string WidgetData_GetContent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_GetWindow")] + public static extern global::System.IntPtr WidgetData_GetWindow(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_SetArgs")] + public static extern void WidgetData_SetArgs(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_SetContent")] + public static extern void WidgetData_SetContent(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_SetWindow")] + public static extern void WidgetData_SetWindow(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceCreateSignalType_Empty")] + public static extern bool WidgetInstanceCreateSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceCreateSignalType_GetConnectionCount")] + public static extern uint WidgetInstanceCreateSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceCreateSignalType_Connect")] + public static extern void WidgetInstanceCreateSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceCreateSignalType_Disconnect")] + public static extern void WidgetInstanceCreateSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceCreateSignalType_Emit")] + public static extern void WidgetInstanceCreateSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetInstanceCreateSignalType")] + public static extern global::System.IntPtr new_WidgetInstanceCreateSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetInstanceCreateSignalType")] + public static extern void delete_WidgetInstanceCreateSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceTerminateSignalType_Empty")] + public static extern bool WidgetInstanceTerminateSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceTerminateSignalType_GetConnectionCount")] + public static extern uint WidgetInstanceTerminateSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceTerminateSignalType_Connect")] + public static extern void WidgetInstanceTerminateSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceTerminateSignalType_Disconnect")] + public static extern void WidgetInstanceTerminateSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceTerminateSignalType_Emit")] + public static extern void WidgetInstanceTerminateSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetInstanceTerminateSignalType")] + public static extern global::System.IntPtr new_WidgetInstanceTerminateSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetInstanceTerminateSignalType")] + public static extern void delete_WidgetInstanceTerminateSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstancePauseOrResumeSignalType_Empty")] + public static extern bool WidgetInstancePauseOrResumeSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstancePauseOrResumeSignalType_GetConnectionCount")] + public static extern uint WidgetInstancePauseOrResumeSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstancePauseOrResumeSignalType_Connect")] + public static extern void WidgetInstancePauseOrResumeSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstancePauseOrResumeSignalType_Disconnect")] + public static extern void WidgetInstancePauseOrResumeSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstancePauseOrResumeSignalType_Emit")] + public static extern void WidgetInstancePauseOrResumeSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetInstancePauseOrResumeSignalType")] + public static extern global::System.IntPtr new_WidgetInstancePauseOrResumeSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetInstancePauseOrResumeSignalType")] + public static extern void delete_WidgetInstancePauseOrResumeSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceResizeSignalType_Empty")] + public static extern bool WidgetInstanceResizeSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceResizeSignalType_GetConnectionCount")] + public static extern uint WidgetInstanceResizeSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceResizeSignalType_Connect")] + public static extern void WidgetInstanceResizeSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceResizeSignalType_Disconnect")] + public static extern void WidgetInstanceResizeSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceResizeSignalType_Emit")] + public static extern void WidgetInstanceResizeSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetInstanceResizeSignalType")] + public static extern global::System.IntPtr new_WidgetInstanceResizeSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetInstanceResizeSignalType")] + public static extern void delete_WidgetInstanceResizeSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceUpdateSignalType_Empty")] + public static extern bool WidgetInstanceUpdateSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceUpdateSignalType_GetConnectionCount")] + public static extern uint WidgetInstanceUpdateSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceUpdateSignalType_Connect")] + public static extern void WidgetInstanceUpdateSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceUpdateSignalType_Disconnect")] + public static extern void WidgetInstanceUpdateSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetInstanceUpdateSignalType_Emit")] + public static extern void WidgetInstanceUpdateSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetInstanceUpdateSignalType")] + public static extern global::System.IntPtr new_WidgetInstanceUpdateSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetInstanceUpdateSignalType")] + public static extern void delete_WidgetInstanceUpdateSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_Empty")] + public static extern bool AppSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_GetConnectionCount")] + public static extern uint AppSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_Connect")] + public static extern void AppSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_Disconnect")] + public static extern void AppSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AppSignalType_Emit")] + public static extern void AppSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AppSignalType")] + public static extern global::System.IntPtr new_AppSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AppSignalType")] + public static extern void delete_AppSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Widget_SWIGUpcast")] + public static extern global::System.IntPtr Widget_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetApplication_SWIGUpcast")] + public static extern global::System.IntPtr WidgetApplication_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetData_SWIGUpcast")] + public static extern global::System.IntPtr WidgetData_SWIGUpcast(global::System.IntPtr jarg1); } } diff --git a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs index 1939974..e6c72b6 100755 --- a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -6296,6 +6296,9 @@ class NDalicPINVOKE { [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_New__SWIG_3")] public static extern global::System.IntPtr Application_New__SWIG_3(int jarg1, string jarg3, int jarg4); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_New__MANUAL_4")] + public static extern global::System.IntPtr Application_New__MANUAL_4(int jarg1, string jarg2, string jarg3, int jarg4); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Application__SWIG_0")] public static extern global::System.IntPtr new_Application__SWIG_0(); @@ -6428,7 +6431,6 @@ class NDalicPINVOKE { [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_Application_New__SWIG_4")] public static extern global::System.IntPtr Application_New__SWIG_4(int jarg1, string jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); - [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimerSignalType_Empty")] public static extern bool TimerSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); diff --git a/src/Tizen.NUI/src/internal/NUICoreBackend.cs b/src/Tizen.NUI/src/internal/NUICoreBackend.cs index 05744b8..3f28755 100755 --- a/src/Tizen.NUI/src/internal/NUICoreBackend.cs +++ b/src/Tizen.NUI/src/internal/NUICoreBackend.cs @@ -30,6 +30,8 @@ namespace Tizen.NUI /// Application instance to connect event. /// protected Application _application; + private string _stylesheet = ""; + private NUIApplication.WindowMode _windowMode = NUIApplication.WindowMode.Opaque; /// /// Dictionary to contain each type of event callback. @@ -41,7 +43,6 @@ namespace Tizen.NUI /// public NUICoreBackend() { - _application = Application.NewApplication(); } /// @@ -49,7 +50,7 @@ namespace Tizen.NUI /// public NUICoreBackend(string stylesheet) { - _application = Application.NewApplication(stylesheet); + _stylesheet = stylesheet; } /// @@ -57,7 +58,8 @@ namespace Tizen.NUI /// public NUICoreBackend(string stylesheet, NUIApplication.WindowMode windowMode) { - _application = Application.NewApplication(stylesheet, (Application.WindowMode)windowMode ); + _stylesheet = stylesheet; + _windowMode = windowMode; } /// @@ -89,7 +91,10 @@ namespace Tizen.NUI /// public void Dispose() { - _application.Dispose(); + if(_application != null) + { + _application.Dispose(); + } } /// @@ -97,7 +102,20 @@ namespace Tizen.NUI /// public void Exit() { - _application.Quit(); + if(_application != null) + { + _application.Quit(); + } + } + + /// + /// Ensures that the function passed in is called from the main loop when it is idle. + /// + /// The function to call + /// true if added successfully, false otherwise + public bool AddIdle(System.Delegate func) + { + return _application.AddIdle(func); } /// @@ -107,6 +125,17 @@ namespace Tizen.NUI public void Run(string[] args) { TizenSynchronizationContext.Initialize(); + + args[0] = Tizen.Applications.Application.Current.ApplicationInfo.ExecutablePath; + if (args.Length == 1) + { + _application = Application.NewApplication(); + } + else if (args.Length > 1) + { + _application = Application.NewApplication(args, _stylesheet, (Application.WindowMode)_windowMode); + } + _application.BatteryLow += OnBatteryLow; _application.LanguageChanged += OnLanguageChanged; _application.MemoryLow += OnMemoryLow; @@ -221,10 +250,9 @@ namespace Tizen.NUI private void OnAppControl(object source, NUIApplicationAppControlEventArgs e) { Log.Debug("NUI", "NUICorebackend OnAppControl Called"); - /* can invoke after making new api which getting control handle at application. var handler = Handlers[EventType.AppControlReceived] as Action; - handler?.Invoke(); - */ + SafeAppControlHandle handle = new SafeAppControlHandle(e.VoidP,false); + handler?.Invoke( new AppControlReceivedEventArgs(new ReceivedAppControl(handle)) ); } /// diff --git a/src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs b/src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs new file mode 100755 index 0000000..ec05e43 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NUIWidgetCoreBackend.cs @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.Collections.Generic; + +using Tizen.Applications.CoreBackend; +using Tizen.Applications; + +namespace Tizen.NUI +{ + class NUIWidgetCoreBackend : ICoreBackend + { + /// + /// Application instance to connect event. + /// + protected WidgetApplication _application; + private string _stylesheet = ""; + + /// + /// Dictionary to contain each type of event callback. + /// + protected IDictionary Handlers = new Dictionary(); + + /// + /// The default Constructor. + /// + public NUIWidgetCoreBackend() + { + //Tizen.Log.Fatal("NUI", "### NUIWidgetCoreBackend called"); + //_application = WidgetApplication.NewWidgetApplication(); + } + + /// + /// The constructor with stylesheet. + /// + public NUIWidgetCoreBackend(string stylesheet) + { + _stylesheet = stylesheet; + //_application = WidgetApplication.NewWidgetApplication(stylesheet); + } + + /// + /// Add NUIWidgetApplication event to Application. + /// Put each type of event callback in Dictionary. + /// + /// Type of event + /// Event callback + public void AddEventHandler(EventType evType, Action handler) + { + Handlers.Add(evType, handler); + } + + /// + /// Add NUIWidgetApplication event to Application. + /// Put each type of event callback in Dictionary. + /// + /// Argument type for the event + /// Type of event + /// Event callback + public void AddEventHandler(EventType evType, Action handler) where TEventArgs : EventArgs + { + Handlers.Add(evType, handler); + } + + + /// + /// Dispose function. + /// + public void Dispose() + { + Tizen.Log.Fatal("NUI", "### NUIWidgetCoreBackend Dispose called"); + if (_application != null) + { + _application.Dispose(); + } + } + + /// + /// Exit Application. + /// + public void Exit() + { + Tizen.Log.Fatal("NUI", "### NUIWidgetCoreBackend Exit called"); + if (_application != null) + { + _application.Quit(); + } + } + + /// + /// Run Application. + /// + /// Arguments from commandline. + public void Run(string[] args) + { + args[0] = Tizen.Applications.Application.Current.ApplicationInfo.ExecutablePath; + _application = WidgetApplication.NewWidgetApplication(args, _stylesheet); + + TizenSynchronizationContext.Initialize(); + _application.BatteryLow += OnBatteryLow; + _application.LanguageChanged += OnLanguageChanged; + _application.MemoryLow += OnMemoryLow; + _application.RegionChanged += OnRegionChanged; ; + + _application.Init += OnInit; + _application.Terminate += OnTerminate; + + _application.MainLoop(); + } + + private void OnInit(object sender, WidgetApplication.WidgetApplicationEventArgs e) + { + Log.Fatal("NUI", "NUIWidgetApplication OnPreCreated Called"); + var preCreateHandler = Handlers[EventType.PreCreated] as Action; + preCreateHandler?.Invoke(); + + Log.Fatal("NUI", "NUIWidgetApplication OnCreate Called"); + var createHandler = Handlers[EventType.Created] as Action; + createHandler?.Invoke(); + + } + + private void OnTerminate(object sender, WidgetApplication.WidgetApplicationEventArgs e) + { + Log.Fatal("NUI", "NUIWidgetApplication OnTerminated Called"); + var handler = Handlers[EventType.Terminated] as Action; + handler?.Invoke(); + } + + /// + /// Region changed event callback function. + /// + /// Application instance + /// Event argument for RegionChanged + private void OnRegionChanged(object sender, WidgetApplication.WidgetApplicationEventArgs e) + { + Log.Fatal("NUI", "NUIWidgetApplication OnRegionChanged Called"); + var handler = Handlers[EventType.RegionFormatChanged] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke(new RegionFormatChangedEventArgs("")); + } + + /// + /// Memory Low event callback function. + /// + /// Application instance + /// Event argument for MemoryLow + private void OnMemoryLow(object sender, WidgetApplication.WidgetApplicationEventArgs e) + { + Log.Fatal("NUI", "NUIWidgetApplication OnMemoryLow Called"); + var handler = Handlers[EventType.LowMemory] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke(new LowMemoryEventArgs(LowMemoryStatus.None)); + } + + /// + /// Language changed event callback function. + /// + /// Application instance + /// Event argument for LanguageChanged + private void OnLanguageChanged(object sender, WidgetApplication.WidgetApplicationEventArgs e) + { + + Log.Fatal("NUI", "NUIWidgetApplication OnLanguageChanged Called"); + var handler = Handlers[EventType.LocaleChanged] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke(new LocaleChangedEventArgs("")); + + } + + /// + /// Battery low event callback function. + /// + /// Application instance + /// Event argument for BatteryLow + private void OnBatteryLow(object sender, WidgetApplication.WidgetApplicationEventArgs e) + { + Log.Fatal("NUI", "NUIWidgetApplication OnBatteryLow Called"); + var handler = Handlers[EventType.LowBattery] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke(new LowBatteryEventArgs(LowBatteryStatus.None)); + + } + + internal WidgetApplication WidgetApplicationHandle + { + get + { + return _application; + } + } + } +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_bundle.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_bundle.cs new file mode 100755 index 0000000..2c1c4d0 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_bundle.cs @@ -0,0 +1,40 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class SWIGTYPE_p_bundle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_bundle(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_bundle() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_bundle obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface.cs similarity index 100% rename from src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool.cs rename to src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface.cs diff --git a/src/Tizen.NUI/src/internal/TouchPoint.cs b/src/Tizen.NUI/src/internal/TouchPoint.cs index 956a3c6..e0f21c5 100755 --- a/src/Tizen.NUI/src/internal/TouchPoint.cs +++ b/src/Tizen.NUI/src/internal/TouchPoint.cs @@ -151,7 +151,7 @@ namespace Tizen.NUI get { global::System.IntPtr cPtr = NDalicPINVOKE.TouchPoint_hitActor_get(swigCPtr); - View ret = (cPtr == global::System.IntPtr.Zero) ? null : Registry.GetManagedBaseHandleFromRefObject(cPtr) as View; + View ret = (cPtr == global::System.IntPtr.Zero) ? null : Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } diff --git a/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs b/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs index 94e182e..361ce7e 100755 --- a/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs +++ b/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs @@ -215,7 +215,7 @@ namespace Tizen.NUI public VisualBase GetVisual(int index) { System.IntPtr cPtr = NDalicManualPINVOKE.ViewWrapperImpl_GetVisual(swigCPtr, index); - VisualBase ret = Registry.GetManagedBaseHandleFromRefObject(cPtr) as VisualBase; + VisualBase ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as VisualBase; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/internal/WidgetApplication.cs b/src/Tizen.NUI/src/internal/WidgetApplication.cs new file mode 100755 index 0000000..9d16fd9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetApplication.cs @@ -0,0 +1,576 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + /// + /// Widget application + /// + internal class WidgetApplication : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetApplication_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetApplication obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Window instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (_initCallback != null) + { + this.InitSignal().Disconnect(_initCallback); + } + if (_terminateCallback != null) + { + this.TerminateSignal().Disconnect(_terminateCallback); + } + if (_languageChangedCallback != null) + { + this.LanguageChangedSignal().Disconnect(_languageChangedCallback);; + } + if (_regionChangedCallback != null) + { + this.RegionChangedSignal().Disconnect(_regionChangedCallback); + } + if (_batteryLowCallback != null) + { + this.BatteryLowSignal().Disconnect(_batteryLowCallback); + } + if (_memoryLowCallback != null) + { + this.MemoryLowSignal().Disconnect(_memoryLowCallback); + } + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetApplication(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + internal static WidgetApplication GetWidgetApplicationFromPtr(global::System.IntPtr cPtr) + { + WidgetApplication ret = new WidgetApplication(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static WidgetApplication instance + { + get + { + return _instance; + } + } + + internal void SetupDelegates() + { + InitDelegateInternal initializeCallback = new InitDelegateInternal(Initialization); + + NUILog.Debug("InitSignal connection count"); + this.InitSignal().Connect(initializeCallback); + + NUILog.Debug("InitSignal connection count = " + InitSignal().GetConnectionCount()); + } + + public static WidgetApplication NewWidgetApplication(string[] args, string stylesheet) + { + WidgetApplication ret = New(args, stylesheet); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + // we've got an application now connect the signals + ret.SetupDelegates(); + _instance = ret; + return ret; + } + + public static WidgetApplication New(string[] args, string stylesheet) + { + int argc = args.Length; + string argvStr = string.Join(" ", args); + + WidgetApplication ret = new WidgetApplication(NDalicManualPINVOKE.WidgetApplication_New(argc, argvStr, stylesheet), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetApplication(WidgetApplication widgetApplication) : this(NDalicManualPINVOKE.new_WidgetApplication__SWIG_1(WidgetApplication.getCPtr(widgetApplication)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetApplication Assign(WidgetApplication widgetApplication) + { + WidgetApplication ret = new WidgetApplication(NDalicManualPINVOKE.WidgetApplication_Assign(swigCPtr, WidgetApplication.getCPtr(widgetApplication)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// This starts the application. + /// + public void MainLoop() + { + NDalicManualPINVOKE.WidgetApplication_MainLoop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// This quits the application. + /// Tizen applications should use Lower to improve re-start performance unless they need to Quit completely. + /// + public void Quit() + { + NDalicManualPINVOKE.WidgetApplication_Quit(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Get window. + /// + /// The window for widget instance. + public Window GetWindow() + { + Window ret = new Window(NDalicManualPINVOKE.WidgetApplication_GetWindow(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Get path application resources are stored at. + /// + /// The full path of the resources + public static string GetResourcePath() + { + string ret = NDalicManualPINVOKE.WidgetApplication_GetResourcePath(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via widget app event signal. + /// + public class WidgetApplicationEventArgs : EventArgs + { + /// + /// Widget application. + /// + public WidgetApplication WidgetApplication + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void InitCallbackType(IntPtr widgetApplication); + private InitCallbackType _initCallback; + private DaliEventHandler _initEventHandler; + + /// + /// Init event. + /// + public event DaliEventHandler Init + { + add + { + if (_initEventHandler == null) + { + _initCallback = new InitCallbackType( OnInit); + InitSignal().Connect(_initCallback); + } + + _initEventHandler += value; + } + + remove + { + _initEventHandler -= value; + + if (_initEventHandler == null && InitSignal().Empty() == false) + { + InitSignal().Disconnect(_initCallback); + } + } + } + + private void OnInit(IntPtr widgetApplication) + { + WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); + if (widgetApplication != null) + { + e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); + } + + if (_initEventHandler != null) + { + _initEventHandler(this, e); + } + } + + internal AppSignalType InitSignal() + { + AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_InitSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void TerminateCallbackType(IntPtr widgetApplication); + private TerminateCallbackType _terminateCallback; + private DaliEventHandler _terminateEventHandler; + + /// + /// Terminate event. + /// + public event DaliEventHandler Terminate + { + add + { + if (_terminateEventHandler == null) + { + _terminateCallback = new TerminateCallbackType( OnTerminate); + TerminateSignal().Connect(_terminateCallback); + } + + _terminateEventHandler += value; + } + + remove + { + _terminateEventHandler -= value; + + if (_terminateEventHandler == null && TerminateSignal().Empty() == false) + { + TerminateSignal().Disconnect(_terminateCallback); + } + } + } + + private void OnTerminate(IntPtr widgetApplication) + { + WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); + + if (widgetApplication != null) + { + e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); + } + + if (_terminateEventHandler != null) + { + _terminateEventHandler(this, e); + } + } + + internal AppSignalType TerminateSignal() + { + AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_TerminateSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void LanguageChangedCallbackType(IntPtr widgetApplication); + private LanguageChangedCallbackType _languageChangedCallback; + private DaliEventHandler _languageChangedEventHandler; + + /// + /// LanguageChanged event. + /// + public event DaliEventHandler LanguageChanged + { + add + { + if (_languageChangedEventHandler == null) + { + _languageChangedCallback = new LanguageChangedCallbackType( OnLanguageChanged); + LanguageChangedSignal().Connect(_languageChangedCallback); + } + + _languageChangedEventHandler += value; + } + + remove + { + _languageChangedEventHandler -= value; + + if (_languageChangedEventHandler == null && LanguageChangedSignal().Empty() == false) + { + LanguageChangedSignal().Disconnect(_languageChangedCallback); + } + } + } + + private void OnLanguageChanged(IntPtr widgetApplication) + { + WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); + + if (widgetApplication != null) + { + e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); + } + + if (_languageChangedEventHandler != null) + { + _languageChangedEventHandler(this, e); + } + } + + internal AppSignalType LanguageChangedSignal() + { + AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_LanguageChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void RegionChangedCallbackType(IntPtr widgetApplication); + private RegionChangedCallbackType _regionChangedCallback; + private DaliEventHandler _regionChangedEventHandler; + + /// + /// RegionChanged event. + /// + public event DaliEventHandler RegionChanged + { + add + { + if (_regionChangedEventHandler == null) + { + _regionChangedCallback = new RegionChangedCallbackType( OnRegionChanged ); + RegionChangedSignal().Connect(_regionChangedCallback); + } + + _regionChangedEventHandler += value; + } + + remove + { + _regionChangedEventHandler -= value; + + if (_regionChangedEventHandler == null && RegionChangedSignal().Empty() == false) + { + RegionChangedSignal().Disconnect(_regionChangedCallback); + } + } + } + + private void OnRegionChanged(IntPtr widgetApplication) + { + WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); + + if (widgetApplication != null) + { + e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); + } + + if (_regionChangedEventHandler != null) + { + _regionChangedEventHandler(this, e); + } + } + + internal AppSignalType RegionChangedSignal() + { + AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_RegionChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void BatteryLowCallbackType(IntPtr widgetApplication); + private BatteryLowCallbackType _batteryLowCallback; + private DaliEventHandler _batteryLowEventHandler; + + /// + /// BatteryLow event. + /// + public event DaliEventHandler BatteryLow + { + add + { + if (_batteryLowEventHandler == null) + { + _batteryLowCallback = new BatteryLowCallbackType( OnBatteryLow ); + BatteryLowSignal().Connect(_batteryLowCallback); + } + + _batteryLowEventHandler += value; + } + + remove + { + _batteryLowEventHandler -= value; + + if (_batteryLowEventHandler == null && BatteryLowSignal().Empty() == false) + { + BatteryLowSignal().Disconnect(_batteryLowCallback); + } + } + } + + private void OnBatteryLow(IntPtr widgetApplication) + { + WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); + + if (widgetApplication != null) + { + e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); + } + + if (_batteryLowEventHandler != null) + { + _batteryLowEventHandler(this, e); + } + } + + internal AppSignalType BatteryLowSignal() + { + AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_BatteryLowSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void MemoryLowCallbackType(IntPtr widgetApplication); + private MemoryLowCallbackType _memoryLowCallback; + private DaliEventHandler _memoryLowEventHandler; + + /// + /// MemoryLow event. + /// + public event DaliEventHandler MemoryLow + { + add + { + if (_memoryLowEventHandler == null) + { + _memoryLowCallback = new MemoryLowCallbackType (OnMemoryLow); + MemoryLowSignal().Connect(_memoryLowCallback); + } + + _memoryLowEventHandler += value; + } + + remove + { + _memoryLowEventHandler -= value; + + if (_memoryLowEventHandler == null && MemoryLowSignal().Empty() == false) + { + MemoryLowSignal().Disconnect(_memoryLowCallback); + } + } + } + + private void OnMemoryLow(IntPtr widgetApplication) + { + WidgetApplicationEventArgs e = new WidgetApplicationEventArgs(); + + if (widgetApplication != null) + { + e.WidgetApplication = WidgetApplication.GetWidgetApplicationFromPtr(widgetApplication); + } + + if (_memoryLowEventHandler != null) + { + _memoryLowEventHandler(this, e); + } + } + + internal AppSignalType MemoryLowSignal() + { + AppSignalType ret = new AppSignalType(NDalicManualPINVOKE.WidgetApplication_MemoryLowSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public delegate void InitDelegate(); + + public delegate void TerminateDelegate(); + + public delegate void LanguageChangedDelegate(); + + public delegate void RegionChangedDelegate(); + + public delegate void BatteryLowDelegate(); + + public delegate void MemoryLowDelegate(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void InitDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void TerminateDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void LanguageChangedDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void RegionChangedDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void BatteryLowDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void MemoryLowDelegateInternal(); + + static void Initialization() + { + // instance.InitDelegate(); + } + + private static WidgetApplication _instance; //singleton + + } + +} diff --git a/src/Tizen.NUI/src/internal/WidgetInstanceCreateSignalType.cs b/src/Tizen.NUI/src/internal/WidgetInstanceCreateSignalType.cs new file mode 100755 index 0000000..16543dd --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetInstanceCreateSignalType.cs @@ -0,0 +1,143 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class WidgetInstanceCreateSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WidgetInstanceCreateSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetInstanceCreateSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~WidgetInstanceCreateSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetInstanceCreateSignalType(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.WidgetInstanceCreateSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.WidgetInstanceCreateSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceCreateSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceCreateSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetData arg1, SWIGTYPE_p_bundle arg2, Uint16Pair arg3) + { + NDalicManualPINVOKE.WidgetInstanceCreateSignalType_Emit(swigCPtr, WidgetData.getCPtr(arg1), SWIGTYPE_p_bundle.getCPtr(arg2), Uint16Pair.getCPtr(arg3)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WidgetInstanceCreateSignalType() : this(NDalicManualPINVOKE.new_WidgetInstanceCreateSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/WidgetInstancePauseOrResumeSignalType.cs b/src/Tizen.NUI/src/internal/WidgetInstancePauseOrResumeSignalType.cs new file mode 100755 index 0000000..49a170b --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetInstancePauseOrResumeSignalType.cs @@ -0,0 +1,143 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class WidgetInstancePauseOrResumeSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WidgetInstancePauseOrResumeSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetInstancePauseOrResumeSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~WidgetInstancePauseOrResumeSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetInstancePauseOrResumeSignalType(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetData arg) + { + NDalicManualPINVOKE.WidgetInstancePauseOrResumeSignalType_Emit(swigCPtr, WidgetData.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WidgetInstancePauseOrResumeSignalType() : this(NDalicManualPINVOKE.new_WidgetInstancePauseOrResumeSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/WidgetInstanceResizeSignalType.cs b/src/Tizen.NUI/src/internal/WidgetInstanceResizeSignalType.cs new file mode 100755 index 0000000..0685f80 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetInstanceResizeSignalType.cs @@ -0,0 +1,142 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class WidgetInstanceResizeSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WidgetInstanceResizeSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetInstanceResizeSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~WidgetInstanceResizeSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetInstanceResizeSignalType(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.WidgetInstanceResizeSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.WidgetInstanceResizeSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceResizeSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceResizeSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetData arg1, Uint16Pair arg2) + { + NDalicManualPINVOKE.WidgetInstanceResizeSignalType_Emit(swigCPtr, WidgetData.getCPtr(arg1), Uint16Pair.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WidgetInstanceResizeSignalType() : this(NDalicManualPINVOKE.new_WidgetInstanceResizeSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/WidgetInstanceTerminateSignalType.cs b/src/Tizen.NUI/src/internal/WidgetInstanceTerminateSignalType.cs new file mode 100755 index 0000000..1e4327f --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetInstanceTerminateSignalType.cs @@ -0,0 +1,142 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +namespace Tizen.NUI +{ + + internal class WidgetInstanceTerminateSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WidgetInstanceTerminateSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetInstanceTerminateSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~WidgetInstanceTerminateSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetInstanceTerminateSignalType(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetData arg1, SWIGTYPE_p_bundle arg2, Widget.WidgetTerminateType arg3) + { + NDalicManualPINVOKE.WidgetInstanceTerminateSignalType_Emit(swigCPtr, WidgetData.getCPtr(arg1), SWIGTYPE_p_bundle.getCPtr(arg2), (int)arg3); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WidgetInstanceTerminateSignalType() : this(NDalicManualPINVOKE.new_WidgetInstanceTerminateSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/WidgetInstanceUpdateSignalType.cs b/src/Tizen.NUI/src/internal/WidgetInstanceUpdateSignalType.cs new file mode 100755 index 0000000..26480b5 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetInstanceUpdateSignalType.cs @@ -0,0 +1,143 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class WidgetInstanceUpdateSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WidgetInstanceUpdateSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetInstanceUpdateSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~WidgetInstanceUpdateSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetInstanceUpdateSignalType(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.WidgetInstanceUpdateSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.WidgetInstanceUpdateSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceUpdateSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetInstanceUpdateSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetData arg1, SWIGTYPE_p_bundle arg2, int arg3) + { + NDalicManualPINVOKE.WidgetInstanceUpdateSignalType_Emit(swigCPtr, WidgetData.getCPtr(arg1), SWIGTYPE_p_bundle.getCPtr(arg2), arg3); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WidgetInstanceUpdateSignalType() : this(NDalicManualPINVOKE.new_WidgetInstanceUpdateSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs b/src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs index be7d0dd..01525ed 100755 --- a/src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs +++ b/src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs @@ -18,37 +18,37 @@ namespace System { public class ApplicationException : Exception { - public ApplicationException() + public ApplicationException(): base() { - new global::System.ApplicationException(); + //add anything required } - public ApplicationException(string message) + public ApplicationException(string message): base(message) { - new global::System.ApplicationException(message); + //add anything required } - public ApplicationException(string message, Exception innerException) + public ApplicationException(string message, Exception innerException): base(message, innerException) { - new global::System.ApplicationException(message, innerException); + //add anything required } } public class SystemException : Exception { - public SystemException() + public SystemException(): base() { - new global::System.SystemException(); + //add anything required } - public SystemException(string message) + public SystemException(string message): base(message) { - new global::System.SystemException(message); + //add anything required } - public SystemException(string message, Exception innerException) + public SystemException(string message, Exception innerException): base(message, innerException) { - new global::System.SystemException(message, innerException); + //add anything required } } } diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs index b0deba5..422e0ad 100755 --- a/src/Tizen.NUI/src/public/Animation.cs +++ b/src/Tizen.NUI/src/public/Animation.cs @@ -65,6 +65,17 @@ namespace Tizen.NUI } + if (_animationFinishedEventCallback != null) + { + FinishedSignal().Disconnect(_animationFinishedEventCallback); + } + + if (_animationProgressReachedEventCallback != null) + { + + ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback); + } + if(this) { this.Clear(); @@ -73,7 +84,6 @@ namespace Tizen.NUI //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable"); } - //Release your own unmanaged resources here. //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. @@ -175,7 +185,7 @@ namespace Tizen.NUI if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false) { NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); - ProgressReachedSignal().Disconnect(_animationProgressReachedEventHandler); + ProgressReachedSignal().Disconnect(_animationProgressReachedEventCallback); NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); } } @@ -879,6 +889,23 @@ namespace Tizen.NUI return ret; } + private static bool? disableAnimation = null; + private bool DisableAnimation + { + get + { + if (disableAnimation.HasValue == false) + { + string type = Environment.GetEnvironmentVariable("PlatformSmartType"); + if (type == "Entry") + disableAnimation = true; + else + disableAnimation = false; + } + return disableAnimation.Value; + } + } + /// /// Plays the animation. /// @@ -886,9 +913,9 @@ namespace Tizen.NUI { NDalicPINVOKE.Animation_Play(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); -#if DISABLE_ANIMATION - Stop(EndActions.StopFinal); -#endif + + if (DisableAnimation == true) + Stop(EndActions.StopFinal); } /// @@ -908,10 +935,10 @@ namespace Tizen.NUI /// The delay time is not included in the looping time.
/// When the delay time is negative value, it would treat as play immediately.
///
- /// The delay time - public void PlayAfter(int delayMiliSeconds) + /// The delay time + public void PlayAfter(int delayMilliseconds) { - NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMiliSeconds)); + NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMilliseconds)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs b/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs index 37b8cfd..3803986 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs @@ -53,6 +53,8 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + DisConnectFromSignals(); + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -66,6 +68,34 @@ namespace Tizen.NUI.BaseComponents base.Dispose(type); } + private void DisConnectFromSignals() + { + // Save current CPtr. + global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr; + + // Use BaseHandle CPtr as current might have been deleted already in derived classes. + swigCPtr = GetBaseHandleCPtrHandleRef; + + if (_scrollableCompletedCallbackDelegate != null) + { + this.ScrollCompletedSignal().Disconnect(_scrollableCompletedCallbackDelegate); + } + + if (_scrollableUpdatedCallbackDelegate != null) + { + this.ScrollUpdatedSignal().Disconnect(_scrollableUpdatedCallbackDelegate); + } + + if (_scrollableStartedCallbackDelegate != null) + { + this.ScrollStartedSignal().Disconnect(_scrollableStartedCallbackDelegate); + } + + // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here. + // Restore current CPtr. + swigCPtr = currentCPtr; + } + public class StartedEventArgs : EventArgs { private Vector2 _vector2; diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 5ccab67..11e8199 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -64,6 +64,11 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_textEditorTextChangedCallbackDelegate != null) + { + TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -1342,9 +1347,9 @@ namespace Tizen.NUI.BaseComponents } switch (temp) { - case "WORD": + case "WRAP_MODE_WORD": return LineWrapMode.Word; - case "CHARACTER": + case "WRAP_MODE_CHARACTER": return LineWrapMode.Character; default: return LineWrapMode.Word; @@ -1357,12 +1362,12 @@ namespace Tizen.NUI.BaseComponents { case LineWrapMode.Word: { - temp = "WORD"; + temp = "WRAP_MODE_WORD"; break; } case LineWrapMode.Character: { - temp = "CHARACTER"; + temp = "WRAP_MODE_CHARACTER"; break; } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index ba7d45c..09dc7d7 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -63,6 +63,16 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_textFieldMaxLengthReachedCallbackDelegate != null) + { + this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate); + } + + if (_textFieldTextChangedCallbackDelegate != null) + { + TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 4abad84..83931f8 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -757,6 +757,25 @@ namespace Tizen.NUI.BaseComponents } /// + /// TextColorAnimatable property.
+ /// The color of the text that can be animatated.
+ /// Animation framework can be used to change the color of the text when not using mark up.
+ /// Not possible when text is auto scrolling.
+ ///
+ public Color TextColorAnimatable + { + get + { + Color animatableColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE).Get(animatableColor); + return animatableColor; + } + set + { + SetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE, new Tizen.NUI.PropertyValue(value)); + } + } + /// The line count of text. ///
public int LineCount @@ -784,9 +803,9 @@ namespace Tizen.NUI.BaseComponents } switch (temp) { - case "WORD": + case "WRAP_MODE_WORD": return LineWrapMode.Word; - case "CHARACTER": + case "WRAP_MODE_CHARACTER": return LineWrapMode.Character; default: return LineWrapMode.Word; @@ -811,25 +830,5 @@ namespace Tizen.NUI.BaseComponents SetProperty(TextLabel.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue(temp)); } } - - /// TextColorAnimatable property.
- /// The color of the text that can be animatated.
- /// Animation framework can be used to change the color of the text when not using mark up.
- /// Not possible when text is auto scrolling.
- ///
- public Color TextColorAnimatable - { - get - { - Color animatableColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); - GetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE).Get(animatableColor); - return animatableColor; - } - set - { - SetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE, new Tizen.NUI.PropertyValue(value)); - } - } - } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs index 0c8e0de..ae73ef1 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs @@ -55,6 +55,11 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_videoViewFinishedCallbackDelegate != null) + { + FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index cedb4d0..d4a2bec 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -20,12 +20,10 @@ namespace Tizen.NUI.BaseComponents using System; using System.Runtime.InteropServices; - - /// /// View is the base class for all views. /// - public class View : Animatable //CustomActor => Animatable + public class View : Container { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -40,6 +38,88 @@ namespace Tizen.NUI.BaseComponents return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + // From Container Base class + + /// + /// Adds a child view to this View. + /// + /// + /// + public override void Add(View child) + { + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Removes a child View from this View. If the view was not a child of this view, this is a no-op. + /// + /// + /// + public override void Remove(View child) + { + NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves child view by index. + /// + /// + /// + public override View GetChildAt(uint index) + { + IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret ?? null; + } + + /// + /// Retrieves the number of children held by the view. + /// + /// + /// + protected override uint GetChildCount() + { + uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Get the Views parent + /// + /// + protected override Container GetParent() + { + Container ret; + IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); + + BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); + + if(basehandle is Layer) + { + ret = basehandle as Layer; + } + else + { + ret = basehandle as View; + } + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + // you can override it to clean-up your own resources. protected override void Dispose(DisposeTypes type) { @@ -59,6 +139,8 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + DisConnectFromSignals(); + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -72,6 +154,99 @@ namespace Tizen.NUI.BaseComponents base.Dispose(type); } + private void DisConnectFromSignals() + { + // Save current CPtr. + global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr; + + // Use BaseHandle CPtr as current might have been deleted already in derived classes. + swigCPtr = GetBaseHandleCPtrHandleRef; + + if (_onRelayoutEventCallback != null) + { + this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback); + } + + if (_offWindowEventCallback != null) + { + this.OffWindowSignal().Disconnect(_offWindowEventCallback); + } + + if (_onWindowEventCallback != null) + { + this.OnWindowSignal().Disconnect(_onWindowEventCallback); + } + + if (_wheelEventCallback != null) + { + this.WheelEventSignal().Disconnect(_wheelEventCallback); + } + + if (_hoverEventCallback != null) + { + this.HoveredSignal().Disconnect(_hoverEventCallback); + } + + if (_touchDataCallback != null) + { + this.TouchSignal().Disconnect(_touchDataCallback); + } + + if (_ResourcesLoadedCallback != null) + { + this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback); + } + + if (_offWindowEventCallback != null) + { + this.OffWindowSignal().Disconnect(_offWindowEventCallback); + } + + if (_onWindowEventCallback != null) + { + this.OnWindowSignal().Disconnect(_onWindowEventCallback); + } + + if (_wheelEventCallback != null) + { + this.WheelEventSignal().Disconnect(_wheelEventCallback); + } + + if (_hoverEventCallback != null) + { + this.HoveredSignal().Disconnect(_hoverEventCallback); + } + + if (_touchDataCallback != null) + { + this.TouchSignal().Disconnect(_touchDataCallback); + } + + if (_onRelayoutEventCallback != null) + { + this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback); + } + + if (_keyCallback != null) + { + this.KeyEventSignal().Disconnect(_keyCallback); + } + + if (_keyInputFocusLostCallback != null) + { + this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback); + } + + if (_keyInputFocusGainedCallback != null) + { + this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback); + } + + // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here. + // Restore current CPtr. + swigCPtr = currentCPtr; + } + private EventHandler _keyInputFocusGainedEventHandler; [UnmanagedFunctionPointer(CallingConvention.StdCall)] private delegate void KeyInputFocusGainedCallbackType(IntPtr control); @@ -850,9 +1025,10 @@ namespace Tizen.NUI.BaseComponents { View view = null; - if (Parent) + if (Parent is View) { - view = Parent.FindChildById(id); + View parentView = Parent as View; + view = parentView.FindChildById(id); } if (!view) @@ -1699,17 +1875,6 @@ namespace Tizen.NUI.BaseComponents } } - /// - /// Retrieves the view's parent.
- ///
- public View Parent - { - get - { - return GetParent(); - } - } - [Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")] public bool Visible { @@ -2055,32 +2220,6 @@ namespace Tizen.NUI.BaseComponents } /// - /// Adds a child view to this View. - /// - ///
This View(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.
- /// The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. - /// If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view. - /// The child - public void Add(View child) - { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - /// - /// Removes a child View from this View. If the view was not a child of this view, this is a no-op. - /// - ///
This View(the parent) has been initialized. The child view is not the same as the parent view.
- /// The child - public void Remove(View child) - { - NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - /// /// Removes a View from its Parent View / Layer. If the View has no parent, this method does nothing. /// ///
The (child) View has been initialized. 
@@ -2092,36 +2231,6 @@ namespace Tizen.NUI.BaseComponents } /// - /// Retrieves the number of children held by the view. - /// - ///
The View has been initialized.
- /// The number of children - internal uint GetChildCount() - { - uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// - /// Retrieves child view by index. - /// - ///
The View has been initialized.
- /// The index of the child to retrieve - /// The view for the given index or empty handle if children not initialized - public View GetChildAt(uint index) - { - IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); - - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; - - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret ?? null; - } - - /// /// Search through this view's hierarchy for an view with the given name. /// The view itself is also considered in the search. /// @@ -2150,47 +2259,6 @@ namespace Tizen.NUI.BaseComponents return ret; } - /*internal View GetParent() - { - View ret; - IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); - - BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); - - if(basehandle is Layer) - { - ret = new View(cPtr,false); - } - else - { - ret = basehandle as View; - } - - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - }*/ - - internal View GetParent() - { - View ret; - IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); - - BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); - - if(basehandle is Layer) - { - View ret2 = new View(cPtr,false); - return ret2; - } - - ret = basehandle as View; - - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal void SetParentOrigin(Vector3 origin) { NDalicPINVOKE.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin)); @@ -3893,6 +3961,32 @@ namespace Tizen.NUI.BaseComponents } } + [Obsolete("Please DO NOT use! This will be deprecated! Please use 'Container GetParent()' instead!")] + public View Parent + { + get + { + View ret; + IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); + + BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); + + if (basehandle is Layer) + { + ret = new View(cPtr, false); + } + else + { + ret = basehandle as View; + } + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + diff --git a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs index dc36895..d33ce5d 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs @@ -57,7 +57,7 @@ namespace Tizen.NUI.BaseComponents CustomViewRegistry.Instance.Register(CreateInstance, typeof(VisualView)); } - public VisualView() : base(typeof(VisualView).Name, CustomViewBehaviour.ViewBehaviourDefault) + public VisualView() : base(typeof(VisualView).FullName, CustomViewBehaviour.ViewBehaviourDefault) { } diff --git a/src/Tizen.NUI/src/public/BaseHandle.cs b/src/Tizen.NUI/src/public/BaseHandle.cs index c692895..40ed2a1 100755 --- a/src/Tizen.NUI/src/public/BaseHandle.cs +++ b/src/Tizen.NUI/src/public/BaseHandle.cs @@ -25,12 +25,16 @@ namespace Tizen.NUI internal BaseHandle(global::System.IntPtr cPtr, bool cMemoryOwn) { + //to catch derived classes dali native exceptions + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + _registerMe = swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); // using copy constructor to create another native handle so Registry.Unregister works fine. swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.new_BaseHandle__SWIG_2(swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (_registerMe) { @@ -47,6 +51,7 @@ namespace Tizen.NUI // using copy constructor to create another native handle so Registry.Unregister works fine. swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.new_BaseHandle__SWIG_2(swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (_registerMe) { @@ -337,6 +342,14 @@ namespace Tizen.NUI return ret; } + internal global::System.Runtime.InteropServices.HandleRef GetBaseHandleCPtrHandleRef + { + get + { + return swigCPtr; + } + } + } } diff --git a/src/Tizen.NUI/src/public/Container.cs b/src/Tizen.NUI/src/public/Container.cs new file mode 100755 index 0000000..515874e --- /dev/null +++ b/src/Tizen.NUI/src/public/Container.cs @@ -0,0 +1,114 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + /// + /// + /// Container is an abstract class to be inherited from by classes that desire to have Views + /// added to them. + /// + /// + + public abstract class Container : Animatable + { + + internal Container(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + // No un-managed data hence no need to store a native ptr + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + base.Dispose(type); + } + + + /// + /// Adds a child view to this Container. + /// + ///
This Container(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.
+ /// The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. + /// If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view. + /// The child view to add + public abstract void Add( View view ); + + /// + /// Removes a child View from this View. If the view was not a child of this view, this is a no-op. + /// + ///
This View(the parent) has been initialized. The child view is not the same as the parent view.
+ /// The child + public abstract void Remove( View view ); + + /// + /// Retrieves child view by index. + /// + ///
The View has been initialized.
+ /// The index of the child to retrieve + /// The view for the given index or empty handle if children not initialized + public abstract View GetChildAt( uint index ); + + /// + /// Get the parent of this container + /// + ///
The child container has been initialized.
+ /// The parent container + protected abstract Container GetParent(); + + /// + /// Get the number of children for this container + /// + ///
The container has been initialized.
+ /// number of children + protected abstract UInt32 GetChildCount(); + + /// + /// Get the parent Container + /// Read only + /// + ///
The child container has been initialized.
+ /// The parent container + public Container Parent + { + get + { + return GetParent(); + } + } + + /// + /// Get the number of children for this container + /// Read only + /// + ///
The container has been initialized.
+ /// number of children + public uint ChildCount + { + get + { + return GetChildCount(); + } + } + } +} // namespace Tizen.NUI \ No newline at end of file diff --git a/src/Tizen.NUI/src/public/FocusManager.cs b/src/Tizen.NUI/src/public/FocusManager.cs index c528820..ac1aaff 100755 --- a/src/Tizen.NUI/src/public/FocusManager.cs +++ b/src/Tizen.NUI/src/public/FocusManager.cs @@ -65,6 +65,31 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_focusedViewEnterKeyEventCallback2 != null) + { + FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback2); + } + + if (_focusedViewEnterKeyEventCallback != null) + { + FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback); + } + + if (_focusGroupChangedEventCallback != null) + { + FocusGroupChangedSignal().Disconnect(_focusGroupChangedEventCallback); + } + + if (_focusChangedEventCallback != null) + { + FocusChangedSignal().Disconnect(_focusChangedEventCallback); + } + + if (_preFocusChangeCallback != null) + { + PreFocusChangeSignal().Disconnect(_preFocusChangeCallback); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -403,7 +428,7 @@ namespace Tizen.NUI { _focusedViewEnterKeyEventHandler -= value; - if (_focusedViewEnterKeyEventCallback == null && FocusedViewEnterKeySignal().Empty() == false) + if (_focusedViewEnterKeyEventCallback != null && FocusedViewEnterKeySignal().Empty() == false) { FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback); } @@ -729,7 +754,7 @@ namespace Tizen.NUI { _focusedViewEnterKeyEventHandler2 -= value; - if (_focusedViewEnterKeyEventCallback2 == null && FocusedViewEnterKeySignal().Empty() == false) + if (_focusedViewEnterKeyEventCallback2 != null && FocusedViewEnterKeySignal().Empty() == false) { FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback2); } diff --git a/src/Tizen.NUI/src/public/ImfManager.cs b/src/Tizen.NUI/src/public/ImfManager.cs index 16f5728..946f353 100755 --- a/src/Tizen.NUI/src/public/ImfManager.cs +++ b/src/Tizen.NUI/src/public/ImfManager.cs @@ -54,7 +54,37 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - if (swigCPtr.Handle != IntPtr.Zero) + if (_keyboardTypeChangedEventCallback != null) + { + KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback); + } + + if (_imfManagerLanguageChangedEventCallback != null) + { + LanguageChangedSignal().Disconnect(_imfManagerLanguageChangedEventCallback); + } + + if (_imfManagerResizedEventCallback != null) + { + ResizedSignal().Disconnect(_imfManagerResizedEventCallback); + } + + if (_imfManagerStatusChangedEventCallback != null) + { + StatusChangedSignal().Disconnect(_imfManagerStatusChangedEventCallback); + } + + if (_imfManagerEventReceivedEventCallback != null) + { + EventReceivedSignal().Disconnect(_imfManagerEventReceivedEventCallback); + } + + if (_imfManagerActivatedEventCallback != null) + { + ActivatedSignal().Disconnect(_imfManagerActivatedEventCallback); + } + + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) { diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 17179f8..f4aaa35 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -22,7 +22,7 @@ namespace Tizen.NUI /// /// Layers provide a mechanism for overlaying groups of actors on top of each other. /// - public class Layer : Animatable + public class Layer : Container { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -36,6 +36,64 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } + /// from Container base class + + /// + /// Adds a child view to this layer. + /// + /// + /// + public override void Add(View child) + { + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. + /// + /// + /// + public override void Remove(View child) + { + NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves child view by index. + /// + ///
The View has been initialized.
+ /// The index of the child to retrieve + /// The view for the given index or empty handle if children not initialized + public override View GetChildAt(uint index) + { + System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + return ret ?? null; + } + + + protected override Container GetParent() + { + return null; + } + + protected override uint GetChildCount() + { + uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + protected override void Dispose(DisposeTypes type) { if(disposed) @@ -126,32 +184,6 @@ namespace Tizen.NUI } /// - /// Adds a child view to this layer. - /// - ///
This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.
- /// The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. - /// If the child already has a parent, it will be removed from old parent and reparented to this layer. This may change child's position, color, scale etc as it now inherits them from this layer. - /// The child - public void Add(View child) - { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - /// - /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. - /// - ///
This layer(the parent) has been initialized. The child view is not the same as the parent view.
- /// The child - public void Remove(View child) - { - NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - } - - /// /// Queries the depth of the layer.
/// 0 is the bottom most layer, higher number is on top.
///
@@ -286,24 +318,6 @@ namespace Tizen.NUI } /// - /// Retrieves child view by index. - /// - ///
The View has been initialized.
- /// The index of the child to retrieve - /// The view for the given index or empty handle if children not initialized - public View GetChildAt(uint index) - { - System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); - - View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; - - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - return ret ?? null; - } - - /// /// Enumeration for the behavior of the layer. /// public enum LayerBehavior @@ -459,5 +473,6 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + } } diff --git a/src/Tizen.NUI/src/public/NUIApplication.cs b/src/Tizen.NUI/src/public/NUIApplication.cs index 32f9950..77639e8 100755 --- a/src/Tizen.NUI/src/public/NUIApplication.cs +++ b/src/Tizen.NUI/src/public/NUIApplication.cs @@ -182,6 +182,16 @@ namespace Tizen.NUI } /// + /// Ensures that the function passed in is called from the main loop when it is idle. + /// + /// The function to call + /// true if added successfully, false otherwise + public bool AddIdle(System.Delegate func) + { + return ((NUICoreBackend)this.Backend).AddIdle(func); + } + + /// /// Enumeration for deciding whether a NUI application window is opaque or transparent. /// public enum WindowMode diff --git a/src/Tizen.NUI/src/public/NUIWidgetApplication.cs b/src/Tizen.NUI/src/public/NUIWidgetApplication.cs new file mode 100755 index 0000000..c0de24c --- /dev/null +++ b/src/Tizen.NUI/src/public/NUIWidgetApplication.cs @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using Tizen.Applications; +using Tizen.Applications.CoreBackend; +using Tizen.NUI; + +namespace Tizen.NUI +{ + + /// + /// Represents an application that have UI screen. The NUIWidgetApplication class has a default stage. + /// + public class NUIWidgetApplication : CoreApplication + { + + /// + /// The default constructor. + /// + public NUIWidgetApplication() : base(new NUIWidgetCoreBackend()) + { + Tizen.Log.Fatal("NUI", "### NUIWidgetApplication called"); + } + + /// + /// The constructor with stylesheet. + /// + public NUIWidgetApplication(string stylesheet) : base(new NUIWidgetCoreBackend(stylesheet)) + { + Tizen.Log.Fatal("NUI", "### NUIWidgetApplication(string) called"); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnLocaleChanged(LocaleChangedEventArgs e) + { + Log.Fatal("NUI", "OnLocaleChanged() is called!"); + base.OnLocaleChanged(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnLowBattery(LowBatteryEventArgs e) + { + Log.Fatal("NUI", "OnLowBattery() is called!"); + base.OnLowBattery(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnLowMemory(LowMemoryEventArgs e) + { + Log.Fatal("NUI", "OnLowMemory() is called!"); + base.OnLowMemory(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e) + { + Log.Fatal("NUI", "OnRegionFormatChanged() is called!"); + base.OnRegionFormatChanged(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnTerminate() + { + Log.Fatal("NUI", "OnTerminate() is called!"); + base.OnTerminate(); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected virtual void OnPreCreate() + { + Log.Fatal("NUI", "OnPreCreate() is called!"); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnCreate() + { + // This is also required to create DisposeQueue on main thread. + DisposeQueue disposeQ = DisposeQueue.Instance; + disposeQ.Initialize(); + Log.Fatal("NUI","OnCreate() is called!"); + base.OnCreate(); + } + + /// + /// Run NUIWidgetApplication. + /// + /// Arguments from commandline. + public override void Run(string[] args) + { + Backend.AddEventHandler(EventType.PreCreated, OnPreCreate); + base.Run(args); + } + + /// + /// Exit NUIWidgetApplication. + /// + public override void Exit() + { + Tizen.Log.Fatal("NUI", "### NUIWidgetApplication Exit called"); + base.Exit(); + } + + internal WidgetApplication ApplicationHandle + { + get + { + return ((NUIWidgetCoreBackend)this.Backend).WidgetApplicationHandle; + } + } + + /// + /// Get the window instance. + /// + public Window Window + { + get + { + //return Window.Instance; + return ApplicationHandle.GetWindow(); + } + } + } +} diff --git a/src/Tizen.NUI/src/public/StyleManager.cs b/src/Tizen.NUI/src/public/StyleManager.cs index 960b5f4..d579034 100755 --- a/src/Tizen.NUI/src/public/StyleManager.cs +++ b/src/Tizen.NUI/src/public/StyleManager.cs @@ -63,6 +63,11 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_styleManagerStyleChangedCallbackDelegate != null) + { + StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/TTSPlayer.cs b/src/Tizen.NUI/src/public/TTSPlayer.cs index ec2b788..415606b 100755 --- a/src/Tizen.NUI/src/public/TTSPlayer.cs +++ b/src/Tizen.NUI/src/public/TTSPlayer.cs @@ -54,6 +54,11 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_stateChangedEventCallback != null) + { + StateChangedSignal().Disconnect(_stateChangedEventCallback); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/Timer.cs b/src/Tizen.NUI/src/public/Timer.cs index 41c9b7a..f873d6e 100755 --- a/src/Tizen.NUI/src/public/Timer.cs +++ b/src/Tizen.NUI/src/public/Timer.cs @@ -62,6 +62,11 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_timerTickCallbackDelegate != null) + { + TickSignal().Disconnect(_timerTickCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/UIComponents/Button.cs b/src/Tizen.NUI/src/public/UIComponents/Button.cs index a67858d..43eb91a 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Button.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Button.cs @@ -72,6 +72,8 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + DisConnectFromSignals(); + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -85,6 +87,39 @@ namespace Tizen.NUI.UIComponents base.Dispose(type); } + private void DisConnectFromSignals() + { + // Save current CPtr. + global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr; + + // Use BaseHandle CPtr as current might have been deleted already in derived classes. + swigCPtr = GetBaseHandleCPtrHandleRef; + + if (_stateChangedCallback != null) + { + StateChangedSignal().Disconnect(_stateChangedCallback); + } + + if (_releasedCallback != null) + { + ReleasedSignal().Disconnect(_releasedCallback); + } + + if (_pressedCallback != null) + { + this.PressedSignal().Disconnect(_pressedCallback); + } + + if (_clickedCallback != null) + { + ClickedSignal().Disconnect(_clickedCallback); + } + + // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here. + // Restore current CPtr. + swigCPtr = currentCPtr; + } + private EventHandlerWithReturnType _clickedEventHandler; [UnmanagedFunctionPointer(CallingConvention.StdCall)] diff --git a/src/Tizen.NUI/src/public/UIComponents/Popup.cs b/src/Tizen.NUI/src/public/UIComponents/Popup.cs index 24a606d..a39f012 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Popup.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Popup.cs @@ -58,6 +58,31 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_popUpHiddenEventCallbackDelegate != null) + { + HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate); + } + + if (_popUpHidingEventCallbackDelegate != null) + { + HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate); + } + + if (_popUpShownEventCallbackDelegate != null) + { + ShownSignal().Disconnect(_popUpShownEventCallbackDelegate); + } + + if (_popUpShowingEventCallbackDelegate != null) + { + ShowingSignal().Disconnect(_popUpShowingEventCallbackDelegate); + } + + if (_popUpOutsideTouchedEventCallbackDelegate != null) + { + this.OutsideTouchedSignal().Disconnect(_popUpOutsideTouchedEventCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs b/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs index 978e777..a6bde47 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs @@ -60,6 +60,11 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_progressBarValueChangedCallbackDelegate != null) + { + ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs index 51417f2..9a9a5ad 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs @@ -60,6 +60,16 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_scrollBarScrollPositionIntervalReachedEventCallbackDelegate != null) + { + ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate); + } + + if (_scrollBarPanFinishedEventCallbackDelegate != null) + { + PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs index b9bb7ea..67f307f 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs @@ -54,6 +54,11 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_scrollViewSnapStartedCallbackDelegate != null) + { + this.SnapStartedSignal().Disconnect(_scrollViewSnapStartedCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/UIComponents/Slider.cs b/src/Tizen.NUI/src/public/UIComponents/Slider.cs index a7d6882..3bb0e12 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Slider.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Slider.cs @@ -60,6 +60,21 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_sliderValueChangedCallbackDelegate != null) + { + ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate); + } + + if (_sliderSlidingFinishedCallbackDelegate != null) + { + SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate); + } + + if (_sliderMarkReachedCallbackDelegate != null) + { + MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index 01098c3..1c0584d 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -74,7 +74,7 @@ namespace Tizen.NUI _visualSize = value; if (_visualSizePolicy == null) { - _visualSizePolicy = new Vector2(0.0f, 0.0f); + _visualSizePolicy = new Vector2(1.0f, 1.0f); } UpdateVisual(); } @@ -97,7 +97,7 @@ namespace Tizen.NUI _visualOffset = value; if (_visualOffsetPolicy == null) { - _visualOffsetPolicy = new Vector2(0.0f, 0.0f); + _visualOffsetPolicy = new Vector2(1.0f, 1.0f); } UpdateVisual(); } diff --git a/src/Tizen.NUI/src/public/Widget.cs b/src/Tizen.NUI/src/public/Widget.cs new file mode 100755 index 0000000..098e5ab --- /dev/null +++ b/src/Tizen.NUI/src/public/Widget.cs @@ -0,0 +1,620 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +namespace Tizen.NUI +{ + /// + /// Widget object should be created by WidgetApplication. + /// + public class Widget : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Widget(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.Widget_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Widget obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Widget instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_Widget(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// This is the constructor for Widget. + /// + /// for widget instance + public Widget(string id) : this(NDalicManualPINVOKE.Widget_New(id), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Widget(Widget widget) : this(NDalicManualPINVOKE.new_Widget__SWIG_1(Widget.getCPtr(widget)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Widget Assign(Widget widget) + { + Widget ret = new Widget(NDalicManualPINVOKE.Widget_Assign(swigCPtr, Widget.getCPtr(widget)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via KeyEvent signal. + /// + public class CreateEventArgs : EventArgs + { + /// + /// widget data. + /// + public WidgetData WidgetData + { + get; + set; + } + + /// + /// a bundle. + /// + public SWIGTYPE_p_bundle Bundle + { + get; + set; + } + + /// + /// window size. + /// + public Size2D WindowSize + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void CreateCallbackType(IntPtr widgetData, IntPtr bundle, IntPtr windowSize); + private CreateCallbackType _createCallback; + private EventHandler _createEventHandler; + + /// + /// Create event. + /// + public event EventHandler Create + { + add + { + if (_createEventHandler == null) + { + _createCallback = OnCreate; + CreateSignal().Connect(_createCallback); + } + + _createEventHandler += value; + } + + remove + { + _createEventHandler -= value; + + if (_createEventHandler == null && CreateSignal().Empty() == false) + { + CreateSignal().Disconnect(_createCallback); + } + } + } + + private void OnCreate(IntPtr widgetData, IntPtr bundle, IntPtr windowSize) + { + CreateEventArgs e = new CreateEventArgs(); + if (widgetData != null) + { + e.WidgetData = WidgetData.GetWidgetDataFromPtr(widgetData); + } + if (bundle != null) + { + e.Bundle = new SWIGTYPE_p_bundle(bundle, false); + } + if (windowSize != null) + { + var val = new Uint16Pair(windowSize, false); + e.WindowSize = val; + val.Dispose(); + } + + _createEventHandler?.Invoke(this, e); + } + + internal WidgetInstanceCreateSignalType CreateSignal() + { + WidgetInstanceCreateSignalType ret = new WidgetInstanceCreateSignalType(NDalicManualPINVOKE.Widget_CreateSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via terminate event signal. + /// + public class TerminateEventArgs : EventArgs + { + /// + /// widget data. + /// + public WidgetData WidgetData + { + get; + set; + } + + /// + /// a bundle. + /// + public SWIGTYPE_p_bundle Bundle + { + get; + set; + } + + /// + /// widget terminate type. + /// + public WidgetTerminateType WidgetTerminateType + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void TerminateCallbackType(IntPtr widgetData, IntPtr bundle, WidgetTerminateType widgetTerminateType); + private TerminateCallbackType _terminateCallback; + private EventHandler _terminateEventHandler; + + /// + /// Terminate event. + /// + public event EventHandler Terminate + { + add + { + if (_terminateEventHandler == null) + { + _terminateCallback = OnTerminate; + TerminateSignal().Connect(_terminateCallback); + } + + _terminateEventHandler += value; + } + + remove + { + _terminateEventHandler -= value; + + if (_terminateEventHandler == null && TerminateSignal().Empty() == false) + { + TerminateSignal().Disconnect(_terminateCallback); + } + } + } + + private void OnTerminate(IntPtr widgetData, IntPtr bundle, WidgetTerminateType widgetTerminateType) + { + TerminateEventArgs e = new TerminateEventArgs(); + if (widgetData != null) + { + e.WidgetData = WidgetData.GetWidgetDataFromPtr(widgetData); + } + if (bundle != null) + { + e.Bundle = new SWIGTYPE_p_bundle(bundle, false); + } + + e.WidgetTerminateType = widgetTerminateType; + _terminateEventHandler?.Invoke(this, e); + } + + internal WidgetInstanceTerminateSignalType TerminateSignal() + { + WidgetInstanceTerminateSignalType ret = new WidgetInstanceTerminateSignalType(NDalicManualPINVOKE.Widget_TerminateSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via pause event signal. + /// + public class PauseEventArgs : EventArgs + { + /// + /// widget data. + /// + public WidgetData WidgetData + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void PauseCallbackType(IntPtr widgetData); + private PauseCallbackType _pauseCallback; + private EventHandler _pauseEventHandler; + + /// + /// Pause event. + /// + public event EventHandler Pause + { + add + { + if (_pauseEventHandler == null) + { + _pauseCallback = OnPause; + PauseSignal().Connect(_pauseCallback); + } + + _pauseEventHandler += value; + } + + remove + { + _pauseEventHandler -= value; + + if (_pauseEventHandler == null && PauseSignal().Empty() == false) + { + PauseSignal().Disconnect(_pauseCallback); + } + } + } + + private void OnPause(IntPtr widgetData) + { + PauseEventArgs e = new PauseEventArgs(); + if (widgetData != null) + { + e.WidgetData = WidgetData.GetWidgetDataFromPtr(widgetData); + } + + _pauseEventHandler?.Invoke(this, e); + } + + internal WidgetInstancePauseOrResumeSignalType PauseSignal() + { + WidgetInstancePauseOrResumeSignalType ret = new WidgetInstancePauseOrResumeSignalType(NDalicManualPINVOKE.Widget_PauseSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via pause event signal. + /// + public class ResumeEventArgs : EventArgs + { + /// + /// widget data. + /// + public WidgetData WidgetData + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ResumeCallbackType(IntPtr widgetData); + private ResumeCallbackType _resumeCallback; + private EventHandler _resumeEventHandler; + + /// + /// Resume event. + /// + public event EventHandler Resume + { + add + { + if (_resumeEventHandler == null) + { + _resumeCallback = OnResume; + ResumeSignal().Connect(_resumeCallback); + } + + _resumeEventHandler += value; + } + + remove + { + _resumeEventHandler -= value; + + if (_resumeEventHandler == null && ResumeSignal().Empty() == false) + { + ResumeSignal().Disconnect(_resumeCallback); + } + } + } + + private void OnResume(IntPtr widgetData) + { + ResumeEventArgs e = new ResumeEventArgs(); + if (widgetData != null) + { + e.WidgetData = WidgetData.GetWidgetDataFromPtr(widgetData); + } + + _resumeEventHandler?.Invoke(this, e); + } + + internal WidgetInstancePauseOrResumeSignalType ResumeSignal() + { + WidgetInstancePauseOrResumeSignalType ret = new WidgetInstancePauseOrResumeSignalType(NDalicManualPINVOKE.Widget_ResumeSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via resize signal. + /// + public class ResizeEventArgs : EventArgs + { + /// + /// widget data. + /// + public WidgetData WidgetData + { + get; + set; + } + + /// + /// window size. + /// + public Size2D WindowSize + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ResizeCallbackType(IntPtr widgetData, IntPtr windowSize); + private ResizeCallbackType _resizeCallback; + private EventHandler _resizeEventHandler; + + /// + /// Resize event. + /// + public event EventHandler Resize + { + add + { + if (_resizeEventHandler == null) + { + _resizeCallback = OnResize; + ResizeSignal().Connect(_resizeCallback); + } + + _resizeEventHandler += value; + } + + remove + { + _resizeEventHandler -= value; + + if (_resizeEventHandler == null && ResizeSignal().Empty() == false) + { + ResizeSignal().Disconnect(_resizeCallback); + } + } + } + + private void OnResize(IntPtr widgetData, IntPtr windowSize) + { + ResizeEventArgs e = new ResizeEventArgs(); + if (widgetData != null) + { + e.WidgetData = WidgetData.GetWidgetDataFromPtr(widgetData); + } + if (windowSize != null) + { + var val = new Uint16Pair(windowSize, false); + e.WindowSize = val; + val.Dispose(); + } + + _resizeEventHandler?.Invoke(this, e); + } + + internal WidgetInstanceResizeSignalType ResizeSignal() + { + WidgetInstanceResizeSignalType ret = new WidgetInstanceResizeSignalType(NDalicManualPINVOKE.Widget_ResizeSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via update event signal. + /// + public class UpdateEventArgs : EventArgs + { + /// + /// widget data. + /// + public WidgetData WidgetData + { + get; + set; + } + + /// + /// A bundle. + /// + public SWIGTYPE_p_bundle Bundle + { + get; + set; + } + + /// + /// It means several steps. + /// + /// + /// 0 -> no force + /// 1 -> force but do someting + /// 2 -> force + /// + public int Force + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void UpdateCallbackType(IntPtr widgetData, IntPtr bundle, int force); + private UpdateCallbackType _updateCallback; + private EventHandler _updateEventHandler; + + /// + /// Update event. + /// + public event EventHandler Update + { + add + { + if (_updateEventHandler == null) + { + _updateCallback = OnUpdate; + UpdateSignal().Connect(_updateCallback); + } + + _updateEventHandler += value; + } + + remove + { + _updateEventHandler -= value; + + if (_updateEventHandler == null && UpdateSignal().Empty() == false) + { + UpdateSignal().Disconnect(_updateCallback); + } + } + } + + private void OnUpdate(IntPtr widgetData, IntPtr bundle, int force) + { + UpdateEventArgs e = new UpdateEventArgs(); + if (widgetData != null) + { + e.WidgetData = WidgetData.GetWidgetDataFromPtr(widgetData); + } + if (bundle != null) + { + e.Bundle = new SWIGTYPE_p_bundle(bundle, false); + } + e.Force = force; + + _updateEventHandler?.Invoke(this, e); + } + + internal WidgetInstanceUpdateSignalType UpdateSignal() + { + WidgetInstanceUpdateSignalType ret = new WidgetInstanceUpdateSignalType(NDalicManualPINVOKE.Widget_UpdateSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Enumeration for terminate type of widget instance. + /// + public enum WidgetTerminateType + { + /// + /// User deleted this widget from the viewer + /// + Permanent, + /// + /// Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) + /// + Temporary + } + + /// + /// Enumeration for lifecycle event type of widget instance. + /// + public enum WidgetLifecycleEventType + { + /// + /// The widget is dead. + /// + AppDead = 0, + /// + /// The widget is dead. + /// + Create = 1, + /// + /// The widget is destroyed. + /// + Destroy = 2, + /// + /// The widget is paused. + /// + Pause = 3, + /// + /// The widget is resumed. + /// + Resume = 4 + } + } +} diff --git a/src/Tizen.NUI/src/public/WidgetData.cs b/src/Tizen.NUI/src/public/WidgetData.cs new file mode 100755 index 0000000..7053846 --- /dev/null +++ b/src/Tizen.NUI/src/public/WidgetData.cs @@ -0,0 +1,161 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + /// + /// Widget data. + /// + public class WidgetData : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetData(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetData_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetData obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Window instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetData(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + internal static WidgetData GetWidgetDataFromPtr(global::System.IntPtr cPtr) + { + WidgetData ret = new WidgetData(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetData(string instanceId, SWIGTYPE_p_bundle args, string content) : this(NDalicManualPINVOKE.WidgetData_New(instanceId, SWIGTYPE_p_bundle.getCPtr(args), content), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetData(WidgetData widgetData) : this(NDalicManualPINVOKE.new_WidgetData__SWIG_1(WidgetData.getCPtr(widgetData)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetData Assign(WidgetData widgetData) + { + WidgetData ret = new WidgetData(NDalicManualPINVOKE.WidgetData_Assign(swigCPtr, WidgetData.getCPtr(widgetData)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Get widget instance id. + /// + /// Id of widget instance. + public string GetInstanceId() + { + string ret = NDalicManualPINVOKE.WidgetData_GetInstanceId(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_bundle GetArgs() + { + global::System.IntPtr cPtr = NDalicManualPINVOKE.WidgetData_GetArgs(swigCPtr); + SWIGTYPE_p_bundle ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_bundle(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Get widget instance content. + /// + /// Content of widget instance. + public string GetContent() + { + string ret = NDalicManualPINVOKE.WidgetData_GetContent(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Get widget instance Window. + /// + /// Window of widget instance + public Window GetWindow() + { + Window ret = new Window(NDalicManualPINVOKE.WidgetData_GetWindow(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetArgs(SWIGTYPE_p_bundle args) + { + NDalicManualPINVOKE.WidgetData_SetArgs(swigCPtr, SWIGTYPE_p_bundle.getCPtr(args)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Set widget instance arguments. + /// + /// Content of widget instance + public void SetContent(string content) + { + NDalicManualPINVOKE.WidgetData_SetContent(swigCPtr, content); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Set widget instance arguments. + /// + /// Window of widget instance. + public void SetWindow(Window window) + { + NDalicManualPINVOKE.WidgetData_SetWindow(swigCPtr, Window.getCPtr(window)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs index 8c2b91f..e904b4a 100755 --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -30,6 +30,7 @@ namespace Tizen.NUI private global::System.Runtime.InteropServices.HandleRef swigCPtr; private global::System.Runtime.InteropServices.HandleRef stageCPtr; private Layer _rootLayer; + private string _windowTitle; internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn) { @@ -66,6 +67,56 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + if (_windowFocusChangedEventCallback != null) + { + WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback); + } + + if (_stageTouchCallbackDelegate != null) + { + TouchSignal().Disconnect(_stageTouchCallbackDelegate); + } + + if (_stageWheelCallbackDelegate != null) + { + WheelEventSignal().Disconnect(_stageWheelCallbackDelegate); + } + + if (_stageKeyCallbackDelegate != null) + { + KeyEventSignal().Disconnect(_stageKeyCallbackDelegate); + } + + if (_stageEventProcessingFinishedEventCallbackDelegate != null) + { + EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate); + } + + if (_stageContextLostEventCallbackDelegate != null) + { + ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate); + } + + if (_stageContextRegainedEventCallbackDelegate != null) + { + this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate); + } + + if (_stageSceneCreatedEventCallbackDelegate != null) + { + SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate); + } + + if (_windowResizedEventCallback != null) + { + ResizedSignal().Disconnect(_windowResizedEventCallback); + } + + if (_windowFocusChangedEventCallback2 != null) + { + WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2); + } + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -379,6 +430,22 @@ namespace Tizen.NUI } } + /// + /// Gets/Sets a window title. + /// + public string Title + { + get + { + return _windowTitle; + } + set + { + _windowTitle = value; + SetClass( _windowTitle, "" ); + } + } + internal WindowFocusSignalType WindowFocusChangedSignal() { WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false); @@ -424,7 +491,12 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal void SetClass(string name, string klass) + /// + /// Sets the window name and class string. + /// + /// The name of the window + /// The class of the window + public void SetClass(string name, string klass) { NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -767,7 +839,7 @@ namespace Tizen.NUI return ret; } - internal System.IntPtr GetNativeWindowHandler() + public System.IntPtr GetNativeWindowHandler() { System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -1414,6 +1486,11 @@ namespace Tizen.NUI } } + public static void FeedKeyEvent(Key keyEvent) + { + NDalicManualPINVOKE.Window_FeedKeyEvent(Key.getCPtr(keyEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } } } diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs index d9e9bef..f4e6b1a 100755 --- a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs @@ -51,7 +51,7 @@ namespace Tizen.Network.Nsd ///
/// The DNSSD service type /// 4 - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown when serviceType is null. /// Thrown when DNSSD is not supported. public DnssdBrowser(string serviceType) @@ -76,7 +76,7 @@ namespace Tizen.Network.Nsd /// /// 4 /// http://tizen.org/privilege/internet - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown when any other error occurred. /// Thrown when DNSSD is not supported. /// Thrown when permission is denied. @@ -107,7 +107,7 @@ namespace Tizen.Network.Nsd /// Stops browsing the DNSSD remote service. ///
/// 4 - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown when any other error occurred. /// Thrown when DNSSD is not supported. public void StopDiscovery() diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs index 803c6b8..fdf5880 100755 --- a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs @@ -55,7 +55,7 @@ namespace Tizen.Network.Nsd /// The DNSSD service type. It is expressed as type followed by protocol, separated by a dot(e.g. "_ftp._tcp"). /// It must begin with an underscore, followed by 1-15 characters which may be letters, digits or hyphens. /// - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown while setting this property when DNSSD is not supported. /// Thrown when serviceType is set to null. public DnssdService(string serviceType) @@ -90,7 +90,7 @@ namespace Tizen.Network.Nsd /// In case of error, null will be returned during get and exception will be thrown during set. /// /// 4 - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown while setting this property when DNSSD is not supported. /// Thrown when Name value is set to null. /// Thrown while setting this property when any other error occurred. @@ -158,7 +158,7 @@ namespace Tizen.Network.Nsd /// In case of error, -1 will be returned during get and exception will be thrown during set. /// /// 4 - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown while setting this property when DNSSD is not supported. /// Thrown if value of Port is set to less than 0 or more than 65535. /// Thrown while setting this property when any other error occurred. @@ -237,7 +237,7 @@ namespace Tizen.Network.Nsd /// 4 /// The key of the TXT record. It must be a null-terminated string with 9 characters or fewer excluding null. It is case insensitive. /// The value of the TXT record.If null, then "key" will be added with no value. If non-null but value_length is zero, then "key=" will be added with empty value. - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown when DNSSD is not supported. /// Thrown when value of key is null. /// Thrown when any other error occurred. @@ -269,7 +269,7 @@ namespace Tizen.Network.Nsd ///
/// 4 /// The key of the TXT record to be removed. - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown when DNSSD is not supported. /// Thrown when value of key is null. /// Thrown when any other error occurred. @@ -302,7 +302,7 @@ namespace Tizen.Network.Nsd /// Name of the service must be set. /// 4 /// http://tizen.org/privilege/internet - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown when any other error occurred. /// Thrown when DNSSD is not supported. /// Thrown when permission is denied. @@ -337,7 +337,7 @@ namespace Tizen.Network.Nsd /// A local service registered using RegisterService() must be passed. /// /// 4 - /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.service_discovery.dnssd /// Thrown when any other error occurred. /// Thrown when DNSSD is not supported. public void DeregisterService() diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs index 524f921..9782a33 100755 --- a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs @@ -30,8 +30,8 @@ namespace Tizen.Network.Nsd /// /// 4 /// http://tizen.org/privilege/internet - /// http://tizen.org/feature/network.dnssd - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.dnssd + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occured. /// Thrown when DNSSD/SSDP is not supported. /// Thrown when permission is denied. @@ -41,8 +41,8 @@ namespace Tizen.Network.Nsd /// Stops browsing the DNSSD/SSDP remote service. /// /// 4 - /// http://tizen.org/feature/network.dnssd - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.dnssd + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occured. /// Thrown when DNSSD/SSDP is not supported. void StopDiscovery(); diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs index 594fbf0..7b0c6e3 100755 --- a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs @@ -31,8 +31,8 @@ namespace Tizen.Network.Nsd /// /// 4 /// http://tizen.org/privilege/internet - /// http://tizen.org/feature/network.dnssd - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.dnssd + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occurred. /// Thrown when DNSSD/SSDP is not supported. /// Thrown when permission is denied. @@ -45,8 +45,8 @@ namespace Tizen.Network.Nsd /// A local service registered using RegisterService() must be passed. /// /// 4 - /// http://tizen.org/feature/network.dnssd - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.dnssd + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occurred. /// Thrown when DNSSD/SSDP is not supported. void DeregisterService(); diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs index 1ec8bba..e1e4b61 100644 --- a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs @@ -8,10 +8,10 @@ The Tizen.Network.Nsd namespace provides classes to manage the network service d

Related Features

To use DNS-SD, declare the following feature requirements in the config file:
-http://tizen.org/feature/network.dnssd +http://tizen.org/feature/network.service_discovery.dnssd
To use SSDP, declare the following feature requirements in the config file:
-http://tizen.org/feature/network.ssdp +http://tizen.org/feature/network.service_discovery.ssdp
diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs index 2dfb586..69bfd78 100755 --- a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs @@ -51,7 +51,7 @@ namespace Tizen.Network.Nsd /// /// 4 /// The target to browse for the service. - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when target is null. /// Thrown when SSDP is not supported. public SsdpBrowser(string target) @@ -75,7 +75,7 @@ namespace Tizen.Network.Nsd /// Application will keep browsing for available/unavailable services until it calls StopDiscovery(). /// /// 4 - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occured. /// Thrown when SSDP is not supported. public void StartDiscovery() @@ -106,7 +106,7 @@ namespace Tizen.Network.Nsd /// /// 4 /// http://tizen.org/privilege/internet - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occured. /// Thrown when SSDP is not supported. /// Thrown when permission is denied. diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs index 25cc8f3..06cc83d 100755 --- a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs @@ -51,7 +51,7 @@ namespace Tizen.Network.Nsd /// /// 4 /// The SSDP local service's target. It may be a device type or a service type. - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown while setting this property when SSDP is not supported. /// Thrown when target is set to null. public SsdpService(string target) @@ -85,7 +85,7 @@ namespace Tizen.Network.Nsd /// In case of error, null will be returned during get and exception will be thrown during set. /// /// 4 - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown while setting this property when SSDP is not supported. /// Thrown when Usn value is set to null. /// Thrown while setting this property when any other error occurred. @@ -152,7 +152,7 @@ namespace Tizen.Network.Nsd /// In case of error, null will be returned during get and exception will be thrown during set. /// /// 4 - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown while setting this property when SSDP is not supported. /// Thrown when Url value is set to null. /// Thrown while setting this property when any other error occurred. @@ -196,7 +196,7 @@ namespace Tizen.Network.Nsd /// /// 4 /// http://tizen.org/privilege/internet - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occurred. /// Thrown when SSDP is not supported. /// Thrown when permission is denied. @@ -226,7 +226,7 @@ namespace Tizen.Network.Nsd /// A local service registered using RegisterService() must be passed. /// /// 4 - /// http://tizen.org/feature/network.ssdp + /// http://tizen.org/feature/network.service_discovery.ssdp /// Thrown when any other error occurred. /// Thrown when SSDP is not supported. public void DeregisterService() diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln old mode 100755 new mode 100644 index 03602e2..238d76e --- a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.12 +VisualStudioVersion = 15.0.26430.13 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Pims.Contacts", "Tizen.Pims.Contacts.csproj", "{5B40ACBE-A9D5-492B-AB98-11DD8581941E}" EndProject diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs index c1a4043..4be2929 100644 --- a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs @@ -33,7 +33,7 @@ namespace Tizen.Pims.Contacts private Object thisLock = new Object(); private Interop.Database.ContactsDBStatusChangedCallback _contactsDBStatusChangedCallback; private EventHandler _dbStatusChanged; - private Dictionary> _delegateMap = new Dictionary>(); + private Dictionary> _eventHandlerMap = new Dictionary>(); private Dictionary _callbackMap = new Dictionary(); private Interop.Database.ContactsDBChangedCallback _dbChangedDelegate; @@ -709,48 +709,56 @@ namespace Tizen.Pims.Contacts } /// - /// Registers a callback function to be invoked when a record changes. + /// Registers a EventHandler to be invoked when a record changes. /// /// The view URI of records whose changes are monitored /// The EventHandler to register [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")] - public void AddDBChangedDelegate(string viewUri, EventHandler DBChanged) + public void AddDBChangedEventHandler(string viewUri, EventHandler DBChanged) { - if (_callbackMap[viewUri] == null) + if (!_callbackMap.ContainsKey(viewUri)) { _callbackMap[viewUri] = (string uri, IntPtr userData) => { DBChangedEventArgs args = new DBChangedEventArgs(uri); - _delegateMap[uri]?.Invoke(this, args); + _eventHandlerMap[uri]?.Invoke(this, args); }; int error = Interop.Database.AddChangedCb(viewUri, _callbackMap[viewUri], IntPtr.Zero); if ((int)ContactsError.None != error) { - Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error); + Log.Error(Globals.LogTag, "AddDBChangedEventHandler Failed with error " + error); throw ContactsErrorFactory.CheckAndCreateException(error); } } - _delegateMap[viewUri] += DBChanged; + EventHandler handler = null; + if (!_eventHandlerMap.TryGetValue(viewUri, out handler)) + _eventHandlerMap.Add(viewUri, null); + + _eventHandlerMap[viewUri] = handler + DBChanged; } /// - /// Deregisters a callback function. + /// Deregisters a EventHandler. /// /// The view URI of records whose changes are monitored /// The EventHandler to deregister [SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")] - public void RemoveDBChangedDelegate(string viewUri, EventHandler DBChanged) + public void RemoveDBChangedEventHandler(string viewUri, EventHandler DBChanged) { - _delegateMap[viewUri] -= DBChanged; + EventHandler handler = null; + if (!_eventHandlerMap.TryGetValue(viewUri, out handler)) + _eventHandlerMap.Add(viewUri, null); + else + _eventHandlerMap[viewUri] = handler - DBChanged; - if (_delegateMap[viewUri] == null) + if (_eventHandlerMap[viewUri] == null) { int error = Interop.Database.RemoveChangedCb(viewUri, _callbackMap[viewUri], IntPtr.Zero); if ((int)ContactsError.None != error) { - Log.Error(Globals.LogTag, "RemoveDBChangedDelegate Failed with error " + error); + Log.Error(Globals.LogTag, "RemoveDBChangedEventHandler Failed with error " + error); throw ContactsErrorFactory.CheckAndCreateException(error); } _callbackMap.Remove(viewUri);