In this section we provide some code snippets in further information on how to use our WCF CoreService.

 

Connecting:

The easiest way is to add a service reference in Visual Studio.

Another way (and the recommended) is to use the TV4Home.Server.TVEInteractionLibrary.Interfaces assembly which provides all needed interfaces.

To use this you have to add a reference to the assembly and then use the following code to connect to the service.

 

using TV4Home.Server.TVEInteractionLibrary.Interfaces;

ITVEInteraction tvWebClient = null;

public StartConnection(string serverName)
{
tvWebClient = ChannelFactory<ITVEInteraction>.CreateChannel(new BasicHttpBinding() { MaxReceivedMessageSize = 10000000 }, new EndpointAddress(String.Format("http://{0}:4321/TV4Home.Server.CoreService/TVEInteractionService", serverName)));        
}
If the connection is established you can use all of those methods:
        void AddSchedule(int channelId, string title, DateTime startTime, DateTime endTime, int scheduleType);

        void AddScheduleDetailed(int channelId, string title, DateTime startTime, DateTime endTime, int scheduleType, int preRecordInterval, int postRecordInterval, string directory, int priority);
       
        WebVirtualCard SwitchTVServerToChannelAndGetVirtualCard(string userName, int channelId);
      
        string SwitchTVServerToChannelAndGetStreamingUrl(string userName, int channelId);
     
        string SwitchTVServerToChannelAndGetTimeshiftFilename(string userName, int channelId); 
      
        bool CancelCurrentTimeShifting(string userName);

        List<WebChannelDetailed> GetChannelsDetailed(int groupId);
   
        List<WebChannelDetailed> GetChannelsDetailedByRange(int groupId, int startIndex, int count);
      
        List<WebChannelBasic> GetChannelsBasic(int groupId);
    
        List<WebChannelBasic> GetChannelsBasicByRange(int groupId, int startIndex, int count);
      
        int GetChannelCount(int groupId);
       
        List<WebRecording> GetRecordings();
       
        List<WebSchedule> GetSchedules();
        
        WebChannelDetailed GetChannelDetailedById(int channelId);
     
        WebChannelBasic GetChannelBasicById(int channelId);

        WebProgramDetailed GetProgramDetailedById(int programId);
       
        WebProgramBasic GetProgramBasicById(int programId);
     
        List<WebProgramDetailed> GetProgramsDetailedForChannel(int channelId, DateTime startTime, DateTime endTime);
    
        List<WebProgramBasic> GetProgramsBasicForChannel(int channelId, DateTime startTime, DateTime endTime);
      
        bool GetProgramIsScheduledOnChannel(int channelId, int programId);
       
        bool GetProgramIsScheduled(int programId);
      
        List<WebProgramDetailed> SearchProgramsDetailed(string searchTerm);
      
        List<WebProgramBasic> SearchProgramsBasic(string searchTerm);

        List<WebChannelGroup> GetGroups();

        WebChannelGroup GetGroupById(int groupId);
     
        void CancelSchedule(int programId);

        void DeleteSchedule(int scheduleId);
       
        List<WebCard> GetCards();
     
        List<WebVirtualCard> GetActiveCards();

        List<WebRtspClient> GetStreamingClients();
      
        List<WebUser> GetActiveUsers();

        WebProgramDetailed GetCurrentProgramOnChannel(int channelId);
       
        WebProgramDetailed GetNextProgramOnChannel(int channelId);

        string ReadSettingFromDatabase(string tagName);
      
        void WriteSettingToDatabase(string tagName, string value);

Anything missing? If you think a really important feature is missing feel free to use the Issue Tracker http://tv4home.codeplex.com/workitem/list/basic

Last edited Feb 14, 2011 at 2:21 PM by MikeLowrey, version 5

Comments

No comments yet.