neutrino: add support for CST new simple frontpanel with LED segment display. (c) focus and adjusted by me.

Conflicts:
	src/daemonc/remotecontrol.cpp
	src/gui/channellist.cpp


Origin commit data
------------------
Branch: ni/coolstream
Commit: 5f3872b5dd
Author: [CST] Bas <bas@coolstreamtech.com>
Date: 2014-09-26 (Fri, 26 Sep 2014)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Bas
2014-09-26 22:26:39 +08:00
committed by [CST] Focus
parent b70c1407d5
commit 683e1c9095
10 changed files with 185 additions and 63 deletions

View File

@@ -61,7 +61,8 @@ typedef enum {
FP_FLAG_SCROLL_DELAY = 0x08, /* delayed scroll start */
FP_FLAG_ALIGN_LEFT = 0x10, /* align the text in display from the left (default) */
FP_FLAG_ALIGN_RIGHT = 0x20, /* align the text in display from the right (arabic) */
FP_FLAG_UPDATE_SCROLL_POS = 0x40, /* update the current position for scrolling */
FP_FLAG_UPDATE_SCROLL_POS = 0x40, /* update the current position for scrolling (internal use only) */
FP_FLAG_USER = 0x80, /* user flags set (internal use only) */
} fp_flag;
typedef struct {
@@ -101,6 +102,27 @@ typedef struct {
unsigned short cmd;
} fp_standby_cmd_data_t;
typedef enum {
FP_DISPLAY_TEXT_NONE = 0,
FP_DISPLAY_TEXT_LIMITED,
FP_DISPLAY_TEXT_ALL,
} fp_display_text_type_t;
typedef enum {
FP_DISPLAY_TYPE_NONE = 0,
FP_DISPLAY_TYPE_VFD,
FP_DISPLAY_TYPE_OLED,
FP_DISPLAY_TYPE_LED_SEGMENT
} fp_display_type_t;
typedef struct {
fp_display_type_t display_type;
unsigned short xres, yres;
unsigned int segment_count;
fp_display_text_type_t text_support;
bool number_support;
} fp_display_caps_t;
#define IOC_FP_SET_BRIGHT _IOW(0xDE, 1, unsigned char) /* set the display brighness in 16 steps between 0 to 15 */
#define IOC_FP_CLEAR_ALL _IOW(0xDE, 2, unsigned int) /* clear the entire display (both text and icons) */
#define IOC_FP_SET_TEXT _IOW(0xDE, 3, char*) /* set a text to be displayed on the display. If arg == NULL, the text is cleared */
@@ -112,5 +134,8 @@ typedef struct {
#define IOC_FP_LED_CTRL _IOW(0xDE, 9, unsigned char) /* control the Frontpanles LED's (NEO and above only) */
#define IOC_FP_GET_WAKEUP _IOW(0xDE, 10, fp_wakeup_data_t *) /* get wakeup data (NEO and above only) */
#define IOC_FP_STANDBY_CMD _IOW(0xDE, 11, fp_standby_cmd_data_t *) /* get wakeup data (NEO and above only) */
#define IOC_FP_SET_NUMBER _IOW(0xDE, 12, unsigned int) /* set number in display (integer) */
#define IOC_FP_SET_COLON _IOW(0xDE, 13, unsigned char) /* set colon in display (if supported) */
#define IOC_FP_GET_DISPLAY_CAPS _IOW(0xDE, 14, fp_display_caps_t *) /* get display caps */
#endif /* __CS_FRONTPANEL_H__ */

View File

@@ -95,6 +95,7 @@ CRemoteControl::CRemoteControl()
current_channel_id = CZapit::getInstance()->GetCurrentChannelID();;
current_sub_channel_id = 0;
current_channel_name = "";
current_channel_num = -1;
zap_completion_timeout = 0;
@@ -151,10 +152,11 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
is_video_started = true;
if (channel) {
current_channel_name = channel->getName();
current_channel_num = channel->number;
if (channel->Locked() != g_settings.parentallock_defaultlocked)
stopvideo();
}
CVFD::getInstance()->showServicename(current_channel_name); // UTF-8
CVFD::getInstance()->showServicename(current_channel_name, current_channel_num); // UTF-8
current_channel_id = new_id;
current_EPGid = 0;
@@ -291,7 +293,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
if ((*(t_channel_id *)data) == ((msg == NeutrinoMessages::EVT_ZAP_COMPLETE) ? current_channel_id : current_sub_channel_id))
{
CVFD::getInstance()->showServicename(current_channel_name); // UTF-8
CVFD::getInstance()->showServicename(current_channel_name, current_channel_num); // UTF-8
g_Zapit->getPIDS( current_PIDs );
//tuxtxt
#if 1
@@ -320,7 +322,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data
if ((*(t_channel_id *)data) == current_channel_id)
{
needs_nvods = true;
CVFD::getInstance()->showServicename(std::string("[") + current_channel_name + ']'); // UTF-8
CVFD::getInstance()->showServicename(std::string("[") + current_channel_name + ']', current_channel_num); // UTF-8
if ( current_EPGid != 0)
{
getNVODs();
@@ -670,10 +672,11 @@ const std::string & CRemoteControl::subChannelDown(void)
}
}
void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, const bool start_video) // UTF-8
void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, int channum, const bool start_video) // UTF-8
{
current_channel_id = channel_id;
current_channel_name = channame;
current_channel_num = channum;
//printf("zapTo_ChannelID: start_video: %d\n", start_video);
if (start_video)
startvideo();

View File

@@ -74,6 +74,7 @@ class CRemoteControl
//unsigned int current_programm_timer;
uint64_t zap_completion_timeout;
std::string current_channel_name;
int current_channel_num;
t_channel_id current_sub_channel_id;
void getNVODs();
@@ -101,7 +102,7 @@ public:
bool is_video_started;
CRemoteControl();
void zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, const bool start_video = true); // UTF-8
void zapTo_ChannelID(const t_channel_id channel_id, const std::string & channame, int channum, const bool start_video = true); // UTF-8
void startvideo();
void stopvideo();
void queryAPIDs();
@@ -116,6 +117,7 @@ public:
int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data);
inline const std::string & getCurrentChannelName(void) const { return current_channel_name; }
inline const int & getCurrentChannelNumber(void) const { return current_channel_num; }
};

View File

@@ -62,17 +62,54 @@ CVFD::CVFD()
m_progressLocal = 0;
#endif // VFD_UPDATE
has_lcd = 1;
has_lcd = true;
has_led_segment = false;
fd = open("/dev/display", O_RDONLY);
if(fd < 0) {
perror("/dev/display");
has_lcd = 0;
has_lcd = false;
has_led_segment = false;
}
#ifdef BOXMODEL_APOLLO
if (fd >= 0) {
int ret = ioctl(fd, IOC_FP_GET_DISPLAY_CAPS, &caps);
if (ret < 0) {
perror("IOC_FP_GET_DISPLAY_CAPS");
printf("VFD: please update driver!\n");
support_text = true;
support_numbers = true;
} else {
switch (caps.display_type) {
case FP_DISPLAY_TYPE_NONE:
has_lcd = false;
has_led_segment = false;
break;
case FP_DISPLAY_TYPE_LED_SEGMENT:
has_lcd = false;
has_led_segment = true;
break;
default:
has_lcd = true;
has_led_segment = false;
break;
}
support_text = (caps.display_type != FP_DISPLAY_TYPE_LED_SEGMENT &&
caps.text_support != FP_DISPLAY_TEXT_NONE);
support_numbers = caps.number_support;
}
}
#else
support_text = true;
support_numbers = true;
#endif
text[0] = 0;
clearClock = 0;
mode = MODE_TVRADIO;
switch_name_time_cnt = 0;
timeout_cnt = 0;
service_number = -1;
}
CVFD::~CVFD()
@@ -117,7 +154,8 @@ void CVFD::count_down() {
}
void CVFD::wake_up() {
if(!has_lcd) return;
if(fd < 0) return;
if (atoi(g_settings.lcd_setting_dim_time.c_str()) > 0) {
timeout_cnt = atoi(g_settings.lcd_setting_dim_time.c_str());
g_settings.lcd_setting_dim_brightness > -1 ?
@@ -128,6 +166,7 @@ void CVFD::wake_up() {
if(g_settings.lcd_info_line){
switch_name_time_cnt = g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] + 10;
}
}
void* CVFD::TimeThread(void *)
@@ -159,7 +198,7 @@ void CVFD::init(const char * /*fontfile*/, const char * /*fontname*/)
void CVFD::setlcdparameter(int dimm, const int power)
{
if(!has_lcd) return;
if(fd < 0) return;
if(dimm < 0)
dimm = 0;
@@ -182,13 +221,14 @@ printf("CVFD::setlcdparameter dimm %d power %d\n", dimm, power);
void CVFD::setlcdparameter(void)
{
if(!has_lcd) return;
if(fd < 0) return;
last_toggle_state_power = g_settings.lcd_setting[SNeutrinoSettings::LCD_POWER];
setlcdparameter((mode == MODE_STANDBY) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] : (mode == MODE_SHUTDOWN) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] : g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS],
last_toggle_state_power);
}
void CVFD::setled(int led1, int led2){
void CVFD::setled(int led1, int led2)
{
int ret = -1;
if(led1 != -1){
@@ -236,6 +276,8 @@ void CVFD::setled(bool on_off)
}
else {//off
switch(g_settings.led_rec_mode) {
case 1:
led1 = FP_LED_1_OFF; led2 = FP_LED_2_OFF;
break;
case 2:
led1 = FP_LED_1_OFF;
@@ -248,12 +290,13 @@ void CVFD::setled(bool on_off)
break;
}
}
setled(led1, led2);
}
void CVFD::setled(void)
{
if(!has_lcd) return;
if(fd < 0) return;
int led1 = -1, led2 = -1;
int select = 0;
@@ -282,16 +325,21 @@ void CVFD::setled(void)
setled(led1, led2);
}
void CVFD::showServicename(const std::string & name) // UTF-8
void CVFD::showServicename(const std::string & name, int number) // UTF-8
{
if(!has_lcd) return;
if(fd < 0) return;
printf("CVFD::showServicename: %s\n", name.c_str());
servicename = name;
service_number = number;
if (mode != MODE_TVRADIO)
return;
if (support_text)
ShowText(name.c_str());
else
ShowNumber(service_number);
wake_up();
}
@@ -303,11 +351,11 @@ void CVFD::showTime(bool force)
if(!has_lcd)
return;
#endif
if(has_lcd && mode == MODE_SHUTDOWN) {
if(fd >= 0 && mode == MODE_SHUTDOWN) {
ShowIcon(FP_ICON_CAM1, false);
return;
}
if (has_lcd && showclock) {
if (fd >= 0 && showclock) {
if (mode == MODE_STANDBY || ( g_settings.lcd_info_line && (MODE_TVRADIO == mode))) {
char timestr[21];
struct timeb tm;
@@ -319,8 +367,14 @@ void CVFD::showTime(bool force)
if(force || ( switch_name_time_cnt == 0 && ((hour != t->tm_hour) || (minute != t->tm_min))) ) {
hour = t->tm_hour;
minute = t->tm_min;
if (support_text) {
strftime(timestr, 20, "%H:%M", t);
ShowText(timestr);
} else if (support_numbers && has_led_segment) {
ShowNumber((t->tm_hour*100) + t->tm_min);
if (fd >= 0)
ioctl(fd, IOC_FP_SET_COLON, 0x01);
}
}
}
}
@@ -342,8 +396,10 @@ void CVFD::showTime(bool force)
clearClock = 0;
if(has_lcd)
ShowIcon(FP_ICON_CAM1, false);
setled();
}
recstatus = tmp_recstatus;
}
@@ -419,7 +475,7 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update
void CVFD::showMenuText(const int /*position*/, const char * ptext, const int /*highlight*/, const bool /*utf_encoded*/)
{
if(!has_lcd) return;
if(fd < 0) return;
if (mode != MODE_MENU_UTF8)
return;
@@ -429,7 +485,7 @@ void CVFD::showMenuText(const int /*position*/, const char * ptext, const int /*
void CVFD::showAudioTrack(const std::string & /*artist*/, const std::string & title, const std::string & /*album*/)
{
if(!has_lcd) return;
if(fd < 0) return;
if (mode != MODE_AUDIO)
return;
printf("CVFD::showAudioTrack: %s\n", title.c_str());
@@ -445,7 +501,8 @@ printf("CVFD::showAudioTrack: %s\n", title.c_str());
void CVFD::showAudioPlayMode(AUDIOMODES m)
{
if(!has_lcd) return;
if(fd < 0) return;
switch(m) {
case AUDIO_MODE_PLAY:
ShowIcon(FP_ICON_PLAY, true);
@@ -487,7 +544,11 @@ void CVFD::showAudioProgress(const char /*perc*/, bool /*isMuted*/)
void CVFD::setMode(const MODES m, const char * const title)
{
if(!has_lcd) return;
if(fd < 0) return;
// Clear colon in display if it is still there
if (support_numbers && has_led_segment)
ioctl(fd, IOC_FP_SET_COLON, 0x00);
if(mode == MODE_AUDIO)
ShowIcon(FP_ICON_MP3, false);
@@ -584,7 +645,7 @@ void CVFD::setMode(const MODES m, const char * const title)
void CVFD::setBrightness(int bright)
{
if(!has_lcd) return;
if(!has_lcd && !has_led_segment) return;
g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS] = bright;
setlcdparameter();
@@ -601,7 +662,7 @@ int CVFD::getBrightness()
void CVFD::setBrightnessStandby(int bright)
{
if(!has_lcd) return;
if(!has_lcd && !has_led_segment) return;
g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] = bright;
setlcdparameter();
@@ -617,7 +678,7 @@ int CVFD::getBrightnessStandby()
void CVFD::setBrightnessDeepStandby(int bright)
{
if(!has_lcd) return;
if(!has_lcd && !has_led_segment) return;
g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] = bright;
setlcdparameter();
@@ -646,7 +707,7 @@ int CVFD::getPower()
void CVFD::togglePower(void)
{
if(!has_lcd) return;
if(fd < 0) return;
last_toggle_state_power = 1 - last_toggle_state_power;
setlcdparameter((mode == MODE_STANDBY) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_STANDBY_BRIGHTNESS] : (mode == MODE_SHUTDOWN) ? g_settings.lcd_setting[SNeutrinoSettings::LCD_DEEPSTANDBY_BRIGHTNESS] : g_settings.lcd_setting[SNeutrinoSettings::LCD_BRIGHTNESS],
@@ -672,19 +733,19 @@ void CVFD::pause()
void CVFD::Lock()
{
if(!has_lcd) return;
if(fd < 0) return;
creat("/tmp/vfd.locked", 0);
}
void CVFD::Unlock()
{
if(!has_lcd) return;
if(fd < 0) return;
unlink("/tmp/vfd.locked");
}
void CVFD::Clear()
{
if(!has_lcd) return;
if(fd < 0) return;
int ret = ioctl(fd, IOC_FP_CLEAR_ALL, 0);
if(ret < 0)
perror("IOC_FP_SET_TEXT");
@@ -703,6 +764,9 @@ void CVFD::ShowIcon(fp_icon icon, bool show)
void CVFD::ShowText(const char * str)
{
if (fd < 0 || !support_text)
return;
char flags[2] = { FP_FLAG_ALIGN_LEFT, 0 };
if (g_settings.lcd_scroll)
@@ -718,11 +782,29 @@ void CVFD::ShowText(const char * str)
text = txt;
int ret = ioctl(fd, IOC_FP_SET_TEXT, len > 1 ? txt.c_str() : NULL);
if(ret < 0)
if(ret < 0) {
support_text = false;
perror("IOC_FP_SET_TEXT");
}
}
void CVFD::ShowNumber(int number)
{
if (fd < 0 || (!support_text && !support_numbers))
return;
if (number < 0)
return;
int ret = ioctl(fd, IOC_FP_SET_NUMBER, number);
if(ret < 0) {
support_numbers = false;
perror("IOC_FP_SET_NUMBER");
}
}
#ifdef VFD_UPDATE
/*****************************************************************************************/
// showInfoBox
/*****************************************************************************************/

View File

@@ -76,9 +76,15 @@ class CVFD
private:
#ifdef BOXMODEL_APOLLO
fp_display_caps_t caps;
#endif
MODES mode;
std::string servicename;
int service_number;
bool support_text;
bool support_numbers;
char volume;
unsigned char percentOver;
bool muted;
@@ -103,6 +109,7 @@ class CVFD
~CVFD();
bool has_lcd;
bool has_led_segment;
void setlcdparameter(void);
void setled(void);
void setled(bool on_off);
@@ -112,7 +119,7 @@ class CVFD
void setMode(const MODES m, const char * const title = "");
void showServicename(const std::string & name); // UTF-8
void showServicename(const std::string & name, int number = -1); // UTF-8
void showTime(bool force = false);
/** blocks for duration seconds */
void showRCLock(int duration = 2);
@@ -147,6 +154,7 @@ class CVFD
void Clear();
void ShowIcon(fp_icon icon, bool show);
void ShowText(const char *str);
void ShowNumber(int number);
void wake_up();
MODES getMode(void) { return mode; };
#ifdef LCD_UPDATE

View File

@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>

View File

@@ -21,6 +21,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <time.h>

View File

@@ -1194,7 +1194,7 @@ void CChannelList::zapToChannel(CZapitChannel *channel, bool force)
}
selected_chid = channel->getChannelID();
g_RemoteControl->zapTo_ChannelID(selected_chid, channel->getName(), (channel->Locked() == g_settings.parentallock_defaultlocked));
g_RemoteControl->zapTo_ChannelID(selected_chid, channel->getName(), channel->number, (channel->Locked() == g_settings.parentallock_defaultlocked));
CNeutrinoApp::getInstance()->adjustToChannelID(channel->getChannelID());
}
if(new_zap_mode != 2 /* not active */) {

View File

@@ -1358,7 +1358,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data)
//chanready = 1;
showSNR ();
// show failure..!
CVFD::getInstance ()->showServicename ("(" + g_RemoteControl->getCurrentChannelName () + ')');
CVFD::getInstance ()->showServicename ("(" + g_RemoteControl->getCurrentChannelName () + ')', g_RemoteControl->getCurrentChannelNumber());
printf ("zap failed!\n");
showFailure ();
CVFD::getInstance ()->showPercentOver (255);
@@ -1368,7 +1368,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data)
showSNR ();
if ((*(t_channel_id *) data) == channel_id) {
// show failure..!
CVFD::getInstance ()->showServicename ("(" + g_RemoteControl->getCurrentChannelName () + ')');
CVFD::getInstance ()->showServicename ("(" + g_RemoteControl->getCurrentChannelName () + ')', g_RemoteControl->getCurrentChannelNumber());
printf ("zap failed!\n");
showFailure ();
CVFD::getInstance ()->showPercentOver (255);

View File

@@ -577,7 +577,7 @@ void CVideoSettings::nextMode(void)
break;
i++;
if (i >= VIDEOMENU_VIDEOMODE_OPTION_COUNT) {
CVFD::getInstance()->showServicename(g_RemoteControl->getCurrentChannelName());
CVFD::getInstance()->showServicename(g_RemoteControl->getCurrentChannelName(), g_RemoteControl->getCurrentChannelNumber());
return;
}
}
@@ -594,7 +594,7 @@ void CVideoSettings::nextMode(void)
else
break;
}
CVFD::getInstance()->showServicename(g_RemoteControl->getCurrentChannelName());
CVFD::getInstance()->showServicename(g_RemoteControl->getCurrentChannelName(), g_RemoteControl->getCurrentChannelNumber());
//ShowHint(LOCALE_VIDEOMENU_VIDEOMODE, text, 450, 2);
}