kanber_kav
04-09-2009, 08:41 AM
CCcaminfo 1.3 source code..
CCcaminfo.c
/*
* Nano-X GrGrabKey() demo program.
*
* Copyright(C) 2003 Jon Foster <jon@jon-foster.co.uk>
* Based on demo2.c
*
* This program allows the GrGrabKey() API to be tested.
* It creates a window, and displays key and hotkey events it recieves
* in that window. At startup it registers a key with GrGrabKey().
* The key and the registration type can both be specified on the
* command line.
*
* Usage:
* grabdemo key {n|h|x|s}
* Key is numerical MWKEY value (default 55='a').
* The second parameter is a single letter indicating the reservation
* type. Valid values:
* n - Normal (GR_GRAB_HOTKEY_EXCLUSIVE) (default)
* h - Hotkey (GR_GRAB_HOTKEY)
* x - eXclusive (GR_GRAB_EXCLUSIVE)
* m - Mouse (GR_GRAB_EXCLUSIVE_MOUSE)
*/
#define MWINCLUDECOLORS
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <nano-X.h>
#include <signal.h>
#include <string.h>
#include "nxcolors.h"
/*#include <time.h> //Zamanlayıcı için*/
static GR_WINDOW_ID main_window;
static GR_GC_ID main_gc;
static char message1[100] = "--- CCcam Info By AzDev ---Beta V1.3";
static char message3[100] = "Card Server Provid / Handler UpH/Mdwn Provid Name ";
char message2[110][300] ;
int kartim;
#define WIDTH 600
#define HEIGHT 500 //CİZİM ALANI BELİRLE
char server[2000][200];
char mevcut[2000][200];
char anahtar1[2000][9];
char anahtar2[2000][9];
int bulunans;
int bulunana1[2000];
int bulunanb1[2000];
static int Toplam;
int restat;
char caid[6];
char No[2000][7];
char servip[2000][50];
char card[4];
char at[4];
char hadler[7];
char handlerno[2000][9];
char uphops[6];
char uphopsno[2000][2];
char maxdown[8];
char maxdownno [2000][2];
static void draw_menu_key();
int k,adim;
/// Eklenti resim
#define FONTNAME "/MMP/hd/System/font/Font1.ttf"
#define FILE_IMAGE "/EMU/CCcaminfo/image" //azbox
//#define FILE_IMAGE "/root/workspace/azboxy/image" //pc
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
static GR_FONT_ID font;
static GR_IMAGE_ID PopupBox ;
static GR_IMAGE_ID s_iYellow ;
static GR_IMAGE_ID s_iBlue ;
static GR_IMAGE_ID s_pBgImage ;
static GR_IMAGE_ID s_Alt ;
static GR_IMAGE_ID s_Arka ;
#define ROW1_X 100
#define ROW1_Y 400
#define ROW1_H 15
///
static void ResimYukle(void)
{
s_pBgImage =GrLoadImageFromFile(FILE_IMAGE"/Background.png",FALSE);
s_iBlue =GrLoadImageFromFile(FILE_IMAGE"/iBlue.png",FALSE);
s_iYellow =GrLoadImageFromFile(FILE_IMAGE"/iYellow.png", FALSE);
PopupBox =GrLoadImageFromFile(FILE_IMAGE"/PopupBox.png", TRUE);
s_Alt =GrLoadImageFromFile(FILE_IMAGE"/Button.png", TRUE);
s_Arka =GrLoadImageFromFile(FILE_IMAGE"/MaxPopupBox.png", TRUE);
/*
s_pBgImage =GrLoadImageFromFile(FILE_IMAGE"/Background.jpg",FALSE);
s_iBlue =GrLoadImageFromFile(FILE_IMAGE"/iBlue.jpg",FALSE);
s_iYellow =GrLoadImageFromFile(FILE_IMAGE"/iYellow.jpg", FALSE);
PopupBox =GrLoadImageFromFile(FILE_IMAGE"/PopupBox.jpg", TRUE);
s_Alt =GrLoadImageFromFile(FILE_IMAGE"/Button.jpg", TRUE);
s_Arka =GrLoadImageFromFile(FILE_IMAGE"/MaxPopupBox.jpg", TRUE);
*/
}
static void ResimHafiza(void)
{
GrFreeImage(s_pBgImage);
GrFreeImage(s_iBlue);
GrFreeImage(s_iYellow);
GrFreeImage(PopupBox);
GrFreeImage(s_Alt);
GrFreeImage(s_Arka);
}
static void draw_menu_key()
{
font = GrCreateFont(FONTNAME, 15, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
GrDrawImageToFit(main_window,main _gc,100,400 ,24,23,s_iBlue);
GrDrawImageToFit(main_window,main _gc,400,400 ,24,23,s_iYellow);
GrText(main_window, main_gc, 430 ,420, "Reset Emu", -1, GR_TFASCII);
GrText(main_window, main_gc, 130 ,420, "cccam.info Read", -1, GR_TFASCII);
GrDestroyFont(font);
}
typedef struct {
const char *name;
int mode;
// key translation pattern
// 0=DOWN/DOWN/.../UP
// 1=DOWN/DOWN/.../LONG/UP
// 2=DOWN/.../LONG/.../UP
// 3=.../LONG --> DOWN+UP or .../UP --> DOWN/UP
int count;
int key[2];
unsigned short mwkey;
}keys_map_td210;
#define MAX_KEY 60
keys_map_td210 keys_td210[MAX_KEY] = {
{ "MWKEY_ASCII_0", 0, 3, { 0, 4 }, '0'}, // 0 T0
{ "MWKEY_ASCII_1", 0, 3, { 1, 5 }, '1'}, // 1 T1
{ "MWKEY_ASCII_2", 0, 3, { 2, 6 }, '2'}, // 2 T2
{ "MWKEY_ASCII_3", 0, 3, { 3, 7 }, '3'}, // 3 T3
{ "MWKEY_ASCII_4", 0, 3, { 4, 8 }, '4'}, // 4 T4
{ "MWKEY_ASCII_5", 0, 3, { 5, 9 }, '5'}, // 5 T5
{ "MWKEY_ASCII_6", 0, 3, { 6, 10 }, '6'}, // 6 T6
{ "MWKEY_ASCII_7", 0, 3, { 7, 11 }, '7'}, // 7 T7
{ "MWKEY_ASCII_8", 0, 3, { 8, 12 }, '8'}, // 8 T8
{ "MWKEY_ASCII_9", 0, 3, { 9, 13 }, '9'}, // 9 T9
{ "MWKEY_CHANNEL_UP", 0, 3, { 10, 16 }, MWKEY_CHANNEL_UP}, // A CHUP
{ "MWKEY_CHANNEL_DOWN", 0, 3, { 11, 17 }, MWKEY_CHANNEL_DOWN}, // B CHDOWN
{ "Not Allowed", 0, 3, { 12, 18 }, 0}, // C VOLDOWN
{ "Not Allowed", 0, 3, { 13, 19 }, 0}, // D VOLUP
{ "Not Allowed", 2, 6, { 14, 20 }, 0}, // E MUTE
{ "MWKEY_UNKNOWN", 0, 3, { 15, 0 }, MWKEY_UNKNOWN}, // F NONE
{ "MWKEY_ENTER", 0, 3, { 16, 21 }, MWKEY_ENTER}, // 10 OK
{ "MWKEY_MENU", 0, 3, { 17, 22 }, MWKEY_MENU}, // 11 MENU
{ "MWKEY_UP", 0, 3, { 18, 23 }, MWKEY_UP}, // 12 UP
{ "MWKEY_DOWN", 0, 3, { 19, 24 }, MWKEY_DOWN}, // 13 DOWN
{ "MWKEY_LEFT", 0, 3, { 20, 25 }, MWKEY_LEFT}, // 14 LEFT
{ "MWKEY_RIGHT", 0, 3, { 21, 26 }, MWKEY_RIGHT}, // 15 RIGHT
{ "MWKEY_ESCAPE", 0, 3, { 22, 28 }, MWKEY_ESCAPE}, // 16 EXIT
{ "MWKEY_REWIND", 0, 3, { 23, 34 }, MWKEY_REWIND}, // 17 REW
{ "MWKEY_STOP", 0, 3, { 24, 35 }, MWKEY_STOP}, // 18 STOP
{ "MWKEY_PLAY", 0, 3, { 25, 36 }, MWKEY_PLAY}, // 19 PLAY
{ "MWKEY_FAST_FWD", 0, 3, { 26, 37 }, MWKEY_FAST_FWD}, // 1A FWD
{ "MWKEY_TRACK_PREV", 0, 3, { 27, 38 }, MWKEY_TRACK_PREV}, // 1B PREV
{ "MWKEY_TRACK_NEXT", 0, 3, { 28, 39 }, MWKEY_TRACK_NEXT}, // 1C NEXT
{ "MWKEY_RECORD", 0, 3, { 29, 40 }, MWKEY_RECORD}, // 1D RECORD
{ "MWKEY_BACKSPACE", 0, 3, { 30, 14 }, MWKEY_BACKSPACE}, // 1E DEL
{ "MWKEY_UNKNOWN", 0, 3, { 31, 0 }, MWKEY_UNKNOWN}, // 1F NONE
{ "MWKEY_CAPSLOCK", 0, 3, { 32, 15 }, MWKEY_CAPSLOCK}, // 20 CAPS
{ "MWKEY_COLORED_KEY_0", 0, 3, { 33, 58 }, MWKEY_COLORED_KEY_0}, // 21 RED
{ "MWKEY_COLORED_KEY_1", 0, 3, { 34, 59 }, MWKEY_COLORED_KEY_1}, // 22 GREEN
{ "MWKEY_COLORED_KEY_2", 0, 3, { 35, 60 }, MWKEY_COLORED_KEY_2}, // 23 YELLOW
{ "MWKEY_COLORED_KEY_3", 0, 3, { 36, 61 }, MWKEY_COLORED_KEY_3}, // 24 BLUE
{ "MWKEY_GUIDE", 0, 3, { 37, 41 }, MWKEY_GUIDE}, // 25 Guide
{ "MWKEY_F1", 0, 3, { 38, 30 }, MWKEY_F1}, // 26 CHECK
{ "Not Allowed", 0, 3, { 39, 56 }, 0}, // 27 RESOL
{ "MWKEY_INFO", 0, 3, { 40, 47 }, MWKEY_INFO}, // 28 INFO
{ "MWKEY_F2", 0, 3, { 41, 57 }, MWKEY_F2}, // 29 TVRADIO
{ "MWKEY_UNKNOWN", 2, 7, { 42, 1 }, MWKEY_UNKNOWN}, // 2A Power
{ "MWKEY_HOME", 2, 3, { 43, 46 }, MWKEY_HOME}, // 2B Home
{ "Not Allowed", 0, 3, { 44, 53 }, 0}, // 2C UHF
{ "Not Allowed", 0, 3, { 45, 54 }, 0}, // 2D AUX
{ "Not Allowed", 0, 3, { 46, 55 }, 0}, // 2E USB Eject
{ "MWKEY_F3", 0, 3, { 47, 29 }, MWKEY_F3}, // 2F Search
/* New Key */
{ "MWKEY_ESCAPE", 0, 3, { 48, 63 }, MWKEY_ESCAPE}, // 30 UTUBE
{ "MWKEY_ESCAPE", 0, 3, { 49, 64 }, MWKEY_ESCAPE}, // 31 WWW
{ "MWKEY_ESCAPE", 0, 3, { 50, 65 }, MWKEY_ESCAPE}, // 32 EMAIL
/* Front Key */
{ "MWKEY_UP", 0, 3, { 51, 44 }, MWKEY_UP}, // 33 ---UP
{ "MWKEY_DOWN", 0, 3, { 52, 45 }, MWKEY_DOWN}, // 34 ---DOWN
{ "MWKEY_LEFT", 3, 3, { 53, 42 }, MWKEY_LEFT}, // 35 ---LEFT
{ "MWKEY_RIGHT", 3, 3, { 54, 43 }, MWKEY_RIGHT}, // 36 ---RIGHT
{ "MWKEY_HOME", 0, 3, { 55, 46 }, MWKEY_HOME}, // 37 ---LAN(HOME)
//{ "K_LAN__", 0, 3, { 55, 62 }, }, // 37 ---LAN(HOME)
/* Virtual Key */
{ "MWKEY_ESCAPE", 0, 3, { 56, 49 }, MWKEY_ESCAPE}, // 38 SLEEP
{ "MWKEY_ESCAPE", 0, 3, { 57, 50 }, MWKEY_ESCAPE}, // 39 WAKEUP
{ "", 0, 3, { 58, 51 }, MWKEY_UNKNOWN}, // 40 VSLEEP
{ "", 0, 3, { 59, 52 }, MWKEY_UNKNOWN}, // 41 VWAKEUP
};
/* A counter - used so you can see the display being updated. */
static int getSerialNumber(void)
{
static int serial = 0;
if (++serial >= 1000)
serial = 0;
return serial;
}
/* If a character is ASCII, return it, else return a question mark. */
static char keyToChar(int key)
{
if ((key >= 32) && (key <= 127)) {
return (char)key;
} else {
return '?';
}
}
/* Makes a GrGrabKey() type paramater into a human-readable string */
static const char *grabKindName(int kind)
{
switch (kind) {
case GR_GRAB_HOTKEY_EXCLUSIVE:
return "GR_GRAB_HOTKEY_EXCLUSIVE";
case GR_GRAB_HOTKEY:
return "GR_GRAB_HOTKEY";
case GR_GRAB_EXCLUSIVE:
return "GR_GRAB_EXCLUSIVE";
case GR_GRAB_EXCLUSIVE_MOUSE:
return "GR_GRAB_EXCLUSIVE_MOUSE";
default:
return "Invalid GR_GRAB_ mode";
}
}
/* Repaint a specified area of the window */
int repaint(int x, int y, int width, int height)
{ //Sistem ekrana yazırılıyor
font = GrCreateFont(FONTNAME, 10, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
GrSetGCForeground(main_gc, GR_RGB(145,139,90) );//Arka platform rengi
GrDrawImageToFit(main_window,main _gc,x,y ,WIDTH,360,s_Arka);
//GrFillRect(main_window, main_gc, x, y, width, 360);//içi boyalı dikdörtgen
GrSetGCUseBackground(main_gc, GR_FALSE); //DIGTORGEN ARKA PLANINI AL
GrSetGCForeground(main_gc, GR_RGB(58,165,188) );//Arka platform rengi
// GrFillRect(main_window, main_gc, 0, 380, width,60);//içi boyalı dikdörtgen
GrSetGCForeground(main_gc, GR_RGB(255,255,255)); //BUSEKİLDEDE YAZILABİLİR GrGetSysColor(GR_COLOR_APPTEXT) yazi rengi
GrText(main_window, main_gc, 150, 10, message1, -1, GR_TFASCII);
GrSetGCForeground(main_gc, GR_RGB(0,255,0));
font = GrCreateFont(FONTNAME, 15, NULL);
GrText(main_window, main_gc, 10, 30, message3, -1, GR_TFASCII);
font = GrCreateFont(FONTNAME, 10, NULL);
GrSetGCForeground(main_gc, GR_RGB(255,255,255));
int ktm;
adim=40;
for (k=0;k<Toplam;k++)
{ adim=adim+15;
GrText(main_window, main_gc, 10, adim, message2[k], -1, GR_TFASCII);
}
GrDrawImageToFit(main_window,main _gc,0,385 ,WIDTH - 10,50,s_Alt);
//GrRect(main_window, main_gc, 5, 5, WIDTH - 10, 355);
//GrRect(main_window, main_gc, 5,385, WIDTH - 10,50 );
draw_menu_key();
/*
if (restat==1)
{RestatCCcam();
}*/
}
/* Repaint the entire window */
static void repaintAll(void)
{
repaint(0,0,WIDTH,HEIGHT);
}
/*
* Bu plugini yazan
* DreamVDR
* Geliştirilmeye açık koddur.
*/
int DosyaOku()
{
FILE *fp1,*fp2,*fp3;
char birkelime;
char *c;
int a,t,f,b;
a=0;f=0;
fp1 = fopen("/tmp/cccam.info","r");
do {
// birkelime ='bos';
birkelime = fgetc(fp1);
if (birkelime != NULL);
if (birkelime =='\n' )
{birkelime='\n';
server[a][f-1]= '\0';//birkelime;
// server[a][f+1]= '\0';
// anahtar1[a][0]=server[a][f-9];
// anahtar1[a][1]=server[a][f-8];
// anahtar1[a][2]=server[a][f-7];
// anahtar1[a][3]=server[a][f-6];
// anahtar1[a][4]=server[a][f-5];
// anahtar1[a][5]=server[a][f-4];
// anahtar1[a][6]=server[a][f-3];
// anahtar1[a][7]=server[a][f-2];
// anahtar1[a][8]='\0';
int say,saym;
say=0;
saym=0;
int v;
v=0;
for(v=0;v<f;++v)
{ //printf("noooo--- %d----- %d \n",v,f);
if (server[a][v]==' ')
{
printf("say %d \n",say);
saym=0;
say=say+1;
} //anahtar
if (server[a][v]==' ') goto atla;
if (say==0)
{
caid[saym]=server[a][v];
saym=saym+1;
} //say
if (say==1)
{
No[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==2)
{
at[saym]=server[a][v];
saym=saym+1;
} //say
if (say==3)
{
servip[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==4)
{
card[saym]=server[a][v];
saym=saym+1;
} //say
if (say==5)
{
anahtar1[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==6)
{
hadler[saym]=server[a][v];
saym=saym+1;
} //say
if (say==7)
{
handlerno[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==8)
{
uphops[saym]=server[a][v];
saym=saym+1;
} //say
if (say==9)
{
uphopsno[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==10)
{
maxdown[saym]=server[a][v];
saym=saym+1;
} //say
if (say==11)
{
maxdownno[a][saym]=server[a][v];
saym=saym+1;
} //say
atla: "Bosluk";
} //for
// printf("no---%s %d \n",handlerno[0],say);
f=0;
a=a+1;
}
else
{server[a][f]= birkelime;
f=f+1;
}
} while (birkelime != '\377' ); /* Dosya sonu */
fclose(fp1);
f=0;
b=0;
sprintf( message1, "--- CCcam Info By AzDev ---Beta V1.3 ---> Online CARD=%d",a);
fp3 = fopen("CCcam.providers","r");
do {
// birkelime ='bos';
birkelime = fgetc(fp3);
if (birkelime != NULL);
if(birkelime =='\n' )
{birkelime='\n';
mevcut[b][f]= '\0';
anahtar2[b][0]=mevcut[b][0];
anahtar2[b][1]=mevcut[b][1];
anahtar2[b][2]=mevcut[b][2];
anahtar2[b][3]=mevcut[b][3];
anahtar2[b][4]=mevcut[b][4];
anahtar2[b][5]=mevcut[b][5];
anahtar2[b][6]=mevcut[b][6];
anahtar2[b][7]=mevcut[b][7];
anahtar2[b][8]='\0';
// printf("%s",mevcut[b]);
f=0;
b=b+1;
}
else
{mevcut[b][f]= birkelime;
f=f+1;
}
} while (birkelime != '\377' ); /* Dosya sonu */
fclose(fp3);
a=a-1;
t=0;
Bul (a,b);
}
int Bul(int a1,int b1)
{
bulunans=0;
int x,y,g;
g=0;
char *de1,*de2;
for (y=0;y<=a1;++y)
{g=0;
for (x=0;x<=b1;++x)
{
// strncpy(de1, anahtar1[y],7);
// strncpy(de2, anahtar1[x], 7);
int i;
i=0;
for(i=0;i<9;++i)
{
if (anahtar2[x][i]=='a') anahtar2[x][i]='A';
if (anahtar2[x][i]=='b') anahtar2[x][i]='B';
if (anahtar2[x][i]=='c') anahtar2[x][i]='C';
if (anahtar2[x][i]=='d') anahtar2[x][i]='D';
if (anahtar2[x][i]=='e') anahtar2[x][i]='E';
if (anahtar2[x][i]=='f') anahtar2[x][i]='F';
}
i=0;
for(i=0;i<9;++i)
{
if (anahtar1[x][i]=='a') anahtar1[x][i]='A';
if (anahtar1[x][i]=='b') anahtar1[x][i]='B';
if (anahtar1[x][i]=='c') anahtar1[x][i]='C';
if (anahtar1[x][i]=='d') anahtar1[x][i]='D';
if (anahtar1[x][i]=='e') anahtar1[x][i]='E';
if (anahtar1[x][i]=='f') anahtar1[x][i]='F';
}
de1=anahtar1[y];
de2=anahtar2[x];
// printf("---------%s---%s \n",de1,de2);
if (strcmp(de1,de2)==0) //iki sitring(po,nter karşılaştır)
{
bulunana1[bulunans]=y;
bulunanb1[bulunans]=x;
bulunans=bulunans+1;
// printf("%d---%d--%d \n",x,y,bulunans);
g=1;
break;
}//if
} //for x
if (g==0)
{
bulunana1[bulunans]=y;
bulunans=bulunans+1;
bulunanb1[bulunans]=0;
g=0;
}
} //for y
}
int Goster(int aralik2)
{int v,aralik,fg;
char *Stoplam;
char *diz1;
char *diz2;
fg=20;
Toplam=0;
v=0;
if (aralik2<0)
aralik2=0;
aralik=aralik2+fg;
if (aralik>bulunans)
{
aralik=bulunans;
}
for(v=aralik2;v<aralik;++v)
{
int ab,ba;
ba= bulunanb1[v];
ab= bulunana1[v];
// diz1=servip[ab];
diz2=mevcut[ba];
/*
char caid[6];
char No[1000][7];
char servip[1000][50];
char card[4];
char at[4];
char hadler[7];
char handlerno[1000][8];
char uphops[6];
char uphopsno[1000][2];
char maxdown[8];
char maxdownno [1000][2];
*/
sprintf( message2[Toplam],"%s %s %s / %s %s / %s --> %s ",No[ab],servip[ab],anahtar1[ab],handlerno[ab],uphopsno[ab],maxdownno[ab],diz2);
// sprintf( message2[Toplam],"%s %s %s/%s %s/%s --> %s ",No[ab],servip[ab],anahtar1[ab],handlerno[ab],uphopsno[ab],maxdownno[ab],diz2);
// printf("%s \n",message2[Toplam]);
Toplam=Toplam+1;
}
}
/*
do {
for (t=0;t<a;t++)
{
system("cp incubusCamdorg incubusCamd.conf");
system("killall -9 incubusCamd.sigma");
printf("%s",server[t]);
DosyaYAZ (server[t]);
system("cp incubusCamd.conf /EMU/OpenXCAS/incubusCamd/incubusCamd.conf");
system("cd /EMU/OpenXCAS/incubusCamd/ && ./incubusCamd.sigma &");
sleep(6);
}
t=0;
} while(1);
*/
int RestatCCcam()
{
system("killall -9 cccam_module &");
system("cd /EMU/OpenXCAS/CCcamCAS/ && ./cccam_module &");
font = GrCreateFont(FONTNAME, 15, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
GrDrawImageToFit(main_window,main _gc,200,100 ,200,50,PopupBox);
GrText(main_window, main_gc, 250 ,125, "CCcam Restating...", -1, GR_TFASCII);
GrDestroyFont(font);
}
static void Resim_Init(void)
{
ResimYukle();
}
int
main(int argc,char **argv)
{
GR_EVENT event;
GR_WM_PROPERTIES props;
int grabResult;
int key = 'a';
int grabKind = GR_GRAB_HOTKEY_EXCLUSIVE;
DosyaOku();
//Ekranla bağlantı kur
if (GrOpen() < 0) {
printf("Can't open graphics\n");
exit(1);
}
/*
int delay;
delay=0;
do {
delay=delay+1;
if (delay>500) {restat=0;
repaintAll();
delay=0;
printf("deneme ... %d \n",delay);
}
} while (1);
*/
/* pass errors through main loop*/
GrSetErrorHandler(NULL);
Resim_Init();
main_window = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, WIDTH, HEIGHT,
0, GREEN, RED);
props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE;
props.props = GR_WM_PROPS_NOBACKGROUND;
props.title = "Nano-X GrabKey Demo";
GrSetWMProperties(main_window, &props);
main_gc = GrNewGC();
grabResult = GrGrabKey(main_window, key, grabKind);
//printf("%d\n", grabResult);
GrSelectEvents(main_window, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ
| GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP);
GrMapWindow(main_window);
GrSetFocus(main_window);
//GrDrawImageToFit(main_window,main _gc,0, 0,640,480,s_pBgImage); //Arkaplan ekrana yaz
//Basılan Tuşları bul
kartim=0;
for (;;) {
GrGetNextEvent(&event);
switch (event.type)
{
case GR_EVENT_TYPE_EXPOSURE:
repaint(event.exposure.x, event.exposure.y,
event.exposure.width, event.exposure.height);
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
exit(0);
break;
case GR_EVENT_TYPE_ERROR:
printf("\7grabdemo: Error (%s) ", event.error.name);
printf(nxErrorStrings[event.error.code],event.error.id);
break;
case GR_EVENT_TYPE_KEY_DOWN:
{
int i;
for(i=0;i<MAX_KEY;i++)
{
if(keys_td210[i].mwkey == event.keystroke.ch)
{
/* sprintf(message1, "%d uuu %03d Keyrrrr %d (%s) scan %d pressed \n",kartim,
getSerialNumber(), event.keystroke.ch,
keys_td210[i].name, event.keystroke.scancode);*/
if (keys_td210[i].name=="MWKEY_UP")
{//key up
kartim=kartim-1;
}
if (keys_td210[i].name=="MWKEY_DOWN")
{//keydown
kartim=kartim+1;
}
if (keys_td210[i].name=="MWKEY_LEFT")
{//key sol
kartim=kartim-10;
}
if (keys_td210[i].name=="MWKEY_RIGHT")
{//key sağ
kartim=kartim+10;
}
if (keys_td210[i].name=="MWKEY_COLORED_KEY_2")
{//key 0
restat=1;
RestatCCcam();
RestatCCcam();
sleep(5);
restat=0;
DosyaOku();
}
if (keys_td210[i].name=="MWKEY_COLORED_KEY_3")
{//key 0
kartim=0;
DosyaOku();
}
break;
}
}
}
if (kartim<0)
{ kartim=0;}font = GrCreateFont(FONTNAME, 15, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
Goster(kartim);
repaintAll();
break;
}
}
//basılan tuşları bul son
ResimHafiza();
GrClose();
return 0;
}
Makefile source kode
.SUFFIXES:.c.o
CC = mipsel-linux-gcc
INC = ../include/microwin
LIBS = -L../lib -lnano-X
CFLAGS = -I$(INC)
OBJS = CCcaminfo.o
SRCS = CCcaminfo.c
TARGET = CCcaminfo.bin
all : $(TARGET)
$(TARGET) : $(OBJS)
$(CC) -o $@ $(OBJS) $(LIBS)
clean :
rm -rf $(OBJS) CCcaminfo/CCcaminfo CCcaminfo.plugin plugins.lst
install : $(TARGET)
mv CCcaminfo.bin CCcaminfo
mv CCcaminfo/CCcaminfo.bin CCcaminfo/CCcaminfo
tar -cvzf CCcaminfo.plugin CCcaminfo
echo CCcaminfo > plugins.lst
CCcaminfo.c
/*
* Nano-X GrGrabKey() demo program.
*
* Copyright(C) 2003 Jon Foster <jon@jon-foster.co.uk>
* Based on demo2.c
*
* This program allows the GrGrabKey() API to be tested.
* It creates a window, and displays key and hotkey events it recieves
* in that window. At startup it registers a key with GrGrabKey().
* The key and the registration type can both be specified on the
* command line.
*
* Usage:
* grabdemo key {n|h|x|s}
* Key is numerical MWKEY value (default 55='a').
* The second parameter is a single letter indicating the reservation
* type. Valid values:
* n - Normal (GR_GRAB_HOTKEY_EXCLUSIVE) (default)
* h - Hotkey (GR_GRAB_HOTKEY)
* x - eXclusive (GR_GRAB_EXCLUSIVE)
* m - Mouse (GR_GRAB_EXCLUSIVE_MOUSE)
*/
#define MWINCLUDECOLORS
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <nano-X.h>
#include <signal.h>
#include <string.h>
#include "nxcolors.h"
/*#include <time.h> //Zamanlayıcı için*/
static GR_WINDOW_ID main_window;
static GR_GC_ID main_gc;
static char message1[100] = "--- CCcam Info By AzDev ---Beta V1.3";
static char message3[100] = "Card Server Provid / Handler UpH/Mdwn Provid Name ";
char message2[110][300] ;
int kartim;
#define WIDTH 600
#define HEIGHT 500 //CİZİM ALANI BELİRLE
char server[2000][200];
char mevcut[2000][200];
char anahtar1[2000][9];
char anahtar2[2000][9];
int bulunans;
int bulunana1[2000];
int bulunanb1[2000];
static int Toplam;
int restat;
char caid[6];
char No[2000][7];
char servip[2000][50];
char card[4];
char at[4];
char hadler[7];
char handlerno[2000][9];
char uphops[6];
char uphopsno[2000][2];
char maxdown[8];
char maxdownno [2000][2];
static void draw_menu_key();
int k,adim;
/// Eklenti resim
#define FONTNAME "/MMP/hd/System/font/Font1.ttf"
#define FILE_IMAGE "/EMU/CCcaminfo/image" //azbox
//#define FILE_IMAGE "/root/workspace/azboxy/image" //pc
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
static GR_FONT_ID font;
static GR_IMAGE_ID PopupBox ;
static GR_IMAGE_ID s_iYellow ;
static GR_IMAGE_ID s_iBlue ;
static GR_IMAGE_ID s_pBgImage ;
static GR_IMAGE_ID s_Alt ;
static GR_IMAGE_ID s_Arka ;
#define ROW1_X 100
#define ROW1_Y 400
#define ROW1_H 15
///
static void ResimYukle(void)
{
s_pBgImage =GrLoadImageFromFile(FILE_IMAGE"/Background.png",FALSE);
s_iBlue =GrLoadImageFromFile(FILE_IMAGE"/iBlue.png",FALSE);
s_iYellow =GrLoadImageFromFile(FILE_IMAGE"/iYellow.png", FALSE);
PopupBox =GrLoadImageFromFile(FILE_IMAGE"/PopupBox.png", TRUE);
s_Alt =GrLoadImageFromFile(FILE_IMAGE"/Button.png", TRUE);
s_Arka =GrLoadImageFromFile(FILE_IMAGE"/MaxPopupBox.png", TRUE);
/*
s_pBgImage =GrLoadImageFromFile(FILE_IMAGE"/Background.jpg",FALSE);
s_iBlue =GrLoadImageFromFile(FILE_IMAGE"/iBlue.jpg",FALSE);
s_iYellow =GrLoadImageFromFile(FILE_IMAGE"/iYellow.jpg", FALSE);
PopupBox =GrLoadImageFromFile(FILE_IMAGE"/PopupBox.jpg", TRUE);
s_Alt =GrLoadImageFromFile(FILE_IMAGE"/Button.jpg", TRUE);
s_Arka =GrLoadImageFromFile(FILE_IMAGE"/MaxPopupBox.jpg", TRUE);
*/
}
static void ResimHafiza(void)
{
GrFreeImage(s_pBgImage);
GrFreeImage(s_iBlue);
GrFreeImage(s_iYellow);
GrFreeImage(PopupBox);
GrFreeImage(s_Alt);
GrFreeImage(s_Arka);
}
static void draw_menu_key()
{
font = GrCreateFont(FONTNAME, 15, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
GrDrawImageToFit(main_window,main _gc,100,400 ,24,23,s_iBlue);
GrDrawImageToFit(main_window,main _gc,400,400 ,24,23,s_iYellow);
GrText(main_window, main_gc, 430 ,420, "Reset Emu", -1, GR_TFASCII);
GrText(main_window, main_gc, 130 ,420, "cccam.info Read", -1, GR_TFASCII);
GrDestroyFont(font);
}
typedef struct {
const char *name;
int mode;
// key translation pattern
// 0=DOWN/DOWN/.../UP
// 1=DOWN/DOWN/.../LONG/UP
// 2=DOWN/.../LONG/.../UP
// 3=.../LONG --> DOWN+UP or .../UP --> DOWN/UP
int count;
int key[2];
unsigned short mwkey;
}keys_map_td210;
#define MAX_KEY 60
keys_map_td210 keys_td210[MAX_KEY] = {
{ "MWKEY_ASCII_0", 0, 3, { 0, 4 }, '0'}, // 0 T0
{ "MWKEY_ASCII_1", 0, 3, { 1, 5 }, '1'}, // 1 T1
{ "MWKEY_ASCII_2", 0, 3, { 2, 6 }, '2'}, // 2 T2
{ "MWKEY_ASCII_3", 0, 3, { 3, 7 }, '3'}, // 3 T3
{ "MWKEY_ASCII_4", 0, 3, { 4, 8 }, '4'}, // 4 T4
{ "MWKEY_ASCII_5", 0, 3, { 5, 9 }, '5'}, // 5 T5
{ "MWKEY_ASCII_6", 0, 3, { 6, 10 }, '6'}, // 6 T6
{ "MWKEY_ASCII_7", 0, 3, { 7, 11 }, '7'}, // 7 T7
{ "MWKEY_ASCII_8", 0, 3, { 8, 12 }, '8'}, // 8 T8
{ "MWKEY_ASCII_9", 0, 3, { 9, 13 }, '9'}, // 9 T9
{ "MWKEY_CHANNEL_UP", 0, 3, { 10, 16 }, MWKEY_CHANNEL_UP}, // A CHUP
{ "MWKEY_CHANNEL_DOWN", 0, 3, { 11, 17 }, MWKEY_CHANNEL_DOWN}, // B CHDOWN
{ "Not Allowed", 0, 3, { 12, 18 }, 0}, // C VOLDOWN
{ "Not Allowed", 0, 3, { 13, 19 }, 0}, // D VOLUP
{ "Not Allowed", 2, 6, { 14, 20 }, 0}, // E MUTE
{ "MWKEY_UNKNOWN", 0, 3, { 15, 0 }, MWKEY_UNKNOWN}, // F NONE
{ "MWKEY_ENTER", 0, 3, { 16, 21 }, MWKEY_ENTER}, // 10 OK
{ "MWKEY_MENU", 0, 3, { 17, 22 }, MWKEY_MENU}, // 11 MENU
{ "MWKEY_UP", 0, 3, { 18, 23 }, MWKEY_UP}, // 12 UP
{ "MWKEY_DOWN", 0, 3, { 19, 24 }, MWKEY_DOWN}, // 13 DOWN
{ "MWKEY_LEFT", 0, 3, { 20, 25 }, MWKEY_LEFT}, // 14 LEFT
{ "MWKEY_RIGHT", 0, 3, { 21, 26 }, MWKEY_RIGHT}, // 15 RIGHT
{ "MWKEY_ESCAPE", 0, 3, { 22, 28 }, MWKEY_ESCAPE}, // 16 EXIT
{ "MWKEY_REWIND", 0, 3, { 23, 34 }, MWKEY_REWIND}, // 17 REW
{ "MWKEY_STOP", 0, 3, { 24, 35 }, MWKEY_STOP}, // 18 STOP
{ "MWKEY_PLAY", 0, 3, { 25, 36 }, MWKEY_PLAY}, // 19 PLAY
{ "MWKEY_FAST_FWD", 0, 3, { 26, 37 }, MWKEY_FAST_FWD}, // 1A FWD
{ "MWKEY_TRACK_PREV", 0, 3, { 27, 38 }, MWKEY_TRACK_PREV}, // 1B PREV
{ "MWKEY_TRACK_NEXT", 0, 3, { 28, 39 }, MWKEY_TRACK_NEXT}, // 1C NEXT
{ "MWKEY_RECORD", 0, 3, { 29, 40 }, MWKEY_RECORD}, // 1D RECORD
{ "MWKEY_BACKSPACE", 0, 3, { 30, 14 }, MWKEY_BACKSPACE}, // 1E DEL
{ "MWKEY_UNKNOWN", 0, 3, { 31, 0 }, MWKEY_UNKNOWN}, // 1F NONE
{ "MWKEY_CAPSLOCK", 0, 3, { 32, 15 }, MWKEY_CAPSLOCK}, // 20 CAPS
{ "MWKEY_COLORED_KEY_0", 0, 3, { 33, 58 }, MWKEY_COLORED_KEY_0}, // 21 RED
{ "MWKEY_COLORED_KEY_1", 0, 3, { 34, 59 }, MWKEY_COLORED_KEY_1}, // 22 GREEN
{ "MWKEY_COLORED_KEY_2", 0, 3, { 35, 60 }, MWKEY_COLORED_KEY_2}, // 23 YELLOW
{ "MWKEY_COLORED_KEY_3", 0, 3, { 36, 61 }, MWKEY_COLORED_KEY_3}, // 24 BLUE
{ "MWKEY_GUIDE", 0, 3, { 37, 41 }, MWKEY_GUIDE}, // 25 Guide
{ "MWKEY_F1", 0, 3, { 38, 30 }, MWKEY_F1}, // 26 CHECK
{ "Not Allowed", 0, 3, { 39, 56 }, 0}, // 27 RESOL
{ "MWKEY_INFO", 0, 3, { 40, 47 }, MWKEY_INFO}, // 28 INFO
{ "MWKEY_F2", 0, 3, { 41, 57 }, MWKEY_F2}, // 29 TVRADIO
{ "MWKEY_UNKNOWN", 2, 7, { 42, 1 }, MWKEY_UNKNOWN}, // 2A Power
{ "MWKEY_HOME", 2, 3, { 43, 46 }, MWKEY_HOME}, // 2B Home
{ "Not Allowed", 0, 3, { 44, 53 }, 0}, // 2C UHF
{ "Not Allowed", 0, 3, { 45, 54 }, 0}, // 2D AUX
{ "Not Allowed", 0, 3, { 46, 55 }, 0}, // 2E USB Eject
{ "MWKEY_F3", 0, 3, { 47, 29 }, MWKEY_F3}, // 2F Search
/* New Key */
{ "MWKEY_ESCAPE", 0, 3, { 48, 63 }, MWKEY_ESCAPE}, // 30 UTUBE
{ "MWKEY_ESCAPE", 0, 3, { 49, 64 }, MWKEY_ESCAPE}, // 31 WWW
{ "MWKEY_ESCAPE", 0, 3, { 50, 65 }, MWKEY_ESCAPE}, // 32 EMAIL
/* Front Key */
{ "MWKEY_UP", 0, 3, { 51, 44 }, MWKEY_UP}, // 33 ---UP
{ "MWKEY_DOWN", 0, 3, { 52, 45 }, MWKEY_DOWN}, // 34 ---DOWN
{ "MWKEY_LEFT", 3, 3, { 53, 42 }, MWKEY_LEFT}, // 35 ---LEFT
{ "MWKEY_RIGHT", 3, 3, { 54, 43 }, MWKEY_RIGHT}, // 36 ---RIGHT
{ "MWKEY_HOME", 0, 3, { 55, 46 }, MWKEY_HOME}, // 37 ---LAN(HOME)
//{ "K_LAN__", 0, 3, { 55, 62 }, }, // 37 ---LAN(HOME)
/* Virtual Key */
{ "MWKEY_ESCAPE", 0, 3, { 56, 49 }, MWKEY_ESCAPE}, // 38 SLEEP
{ "MWKEY_ESCAPE", 0, 3, { 57, 50 }, MWKEY_ESCAPE}, // 39 WAKEUP
{ "", 0, 3, { 58, 51 }, MWKEY_UNKNOWN}, // 40 VSLEEP
{ "", 0, 3, { 59, 52 }, MWKEY_UNKNOWN}, // 41 VWAKEUP
};
/* A counter - used so you can see the display being updated. */
static int getSerialNumber(void)
{
static int serial = 0;
if (++serial >= 1000)
serial = 0;
return serial;
}
/* If a character is ASCII, return it, else return a question mark. */
static char keyToChar(int key)
{
if ((key >= 32) && (key <= 127)) {
return (char)key;
} else {
return '?';
}
}
/* Makes a GrGrabKey() type paramater into a human-readable string */
static const char *grabKindName(int kind)
{
switch (kind) {
case GR_GRAB_HOTKEY_EXCLUSIVE:
return "GR_GRAB_HOTKEY_EXCLUSIVE";
case GR_GRAB_HOTKEY:
return "GR_GRAB_HOTKEY";
case GR_GRAB_EXCLUSIVE:
return "GR_GRAB_EXCLUSIVE";
case GR_GRAB_EXCLUSIVE_MOUSE:
return "GR_GRAB_EXCLUSIVE_MOUSE";
default:
return "Invalid GR_GRAB_ mode";
}
}
/* Repaint a specified area of the window */
int repaint(int x, int y, int width, int height)
{ //Sistem ekrana yazırılıyor
font = GrCreateFont(FONTNAME, 10, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
GrSetGCForeground(main_gc, GR_RGB(145,139,90) );//Arka platform rengi
GrDrawImageToFit(main_window,main _gc,x,y ,WIDTH,360,s_Arka);
//GrFillRect(main_window, main_gc, x, y, width, 360);//içi boyalı dikdörtgen
GrSetGCUseBackground(main_gc, GR_FALSE); //DIGTORGEN ARKA PLANINI AL
GrSetGCForeground(main_gc, GR_RGB(58,165,188) );//Arka platform rengi
// GrFillRect(main_window, main_gc, 0, 380, width,60);//içi boyalı dikdörtgen
GrSetGCForeground(main_gc, GR_RGB(255,255,255)); //BUSEKİLDEDE YAZILABİLİR GrGetSysColor(GR_COLOR_APPTEXT) yazi rengi
GrText(main_window, main_gc, 150, 10, message1, -1, GR_TFASCII);
GrSetGCForeground(main_gc, GR_RGB(0,255,0));
font = GrCreateFont(FONTNAME, 15, NULL);
GrText(main_window, main_gc, 10, 30, message3, -1, GR_TFASCII);
font = GrCreateFont(FONTNAME, 10, NULL);
GrSetGCForeground(main_gc, GR_RGB(255,255,255));
int ktm;
adim=40;
for (k=0;k<Toplam;k++)
{ adim=adim+15;
GrText(main_window, main_gc, 10, adim, message2[k], -1, GR_TFASCII);
}
GrDrawImageToFit(main_window,main _gc,0,385 ,WIDTH - 10,50,s_Alt);
//GrRect(main_window, main_gc, 5, 5, WIDTH - 10, 355);
//GrRect(main_window, main_gc, 5,385, WIDTH - 10,50 );
draw_menu_key();
/*
if (restat==1)
{RestatCCcam();
}*/
}
/* Repaint the entire window */
static void repaintAll(void)
{
repaint(0,0,WIDTH,HEIGHT);
}
/*
* Bu plugini yazan
* DreamVDR
* Geliştirilmeye açık koddur.
*/
int DosyaOku()
{
FILE *fp1,*fp2,*fp3;
char birkelime;
char *c;
int a,t,f,b;
a=0;f=0;
fp1 = fopen("/tmp/cccam.info","r");
do {
// birkelime ='bos';
birkelime = fgetc(fp1);
if (birkelime != NULL);
if (birkelime =='\n' )
{birkelime='\n';
server[a][f-1]= '\0';//birkelime;
// server[a][f+1]= '\0';
// anahtar1[a][0]=server[a][f-9];
// anahtar1[a][1]=server[a][f-8];
// anahtar1[a][2]=server[a][f-7];
// anahtar1[a][3]=server[a][f-6];
// anahtar1[a][4]=server[a][f-5];
// anahtar1[a][5]=server[a][f-4];
// anahtar1[a][6]=server[a][f-3];
// anahtar1[a][7]=server[a][f-2];
// anahtar1[a][8]='\0';
int say,saym;
say=0;
saym=0;
int v;
v=0;
for(v=0;v<f;++v)
{ //printf("noooo--- %d----- %d \n",v,f);
if (server[a][v]==' ')
{
printf("say %d \n",say);
saym=0;
say=say+1;
} //anahtar
if (server[a][v]==' ') goto atla;
if (say==0)
{
caid[saym]=server[a][v];
saym=saym+1;
} //say
if (say==1)
{
No[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==2)
{
at[saym]=server[a][v];
saym=saym+1;
} //say
if (say==3)
{
servip[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==4)
{
card[saym]=server[a][v];
saym=saym+1;
} //say
if (say==5)
{
anahtar1[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==6)
{
hadler[saym]=server[a][v];
saym=saym+1;
} //say
if (say==7)
{
handlerno[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==8)
{
uphops[saym]=server[a][v];
saym=saym+1;
} //say
if (say==9)
{
uphopsno[a][saym]=server[a][v];
saym=saym+1;
} //say
if (say==10)
{
maxdown[saym]=server[a][v];
saym=saym+1;
} //say
if (say==11)
{
maxdownno[a][saym]=server[a][v];
saym=saym+1;
} //say
atla: "Bosluk";
} //for
// printf("no---%s %d \n",handlerno[0],say);
f=0;
a=a+1;
}
else
{server[a][f]= birkelime;
f=f+1;
}
} while (birkelime != '\377' ); /* Dosya sonu */
fclose(fp1);
f=0;
b=0;
sprintf( message1, "--- CCcam Info By AzDev ---Beta V1.3 ---> Online CARD=%d",a);
fp3 = fopen("CCcam.providers","r");
do {
// birkelime ='bos';
birkelime = fgetc(fp3);
if (birkelime != NULL);
if(birkelime =='\n' )
{birkelime='\n';
mevcut[b][f]= '\0';
anahtar2[b][0]=mevcut[b][0];
anahtar2[b][1]=mevcut[b][1];
anahtar2[b][2]=mevcut[b][2];
anahtar2[b][3]=mevcut[b][3];
anahtar2[b][4]=mevcut[b][4];
anahtar2[b][5]=mevcut[b][5];
anahtar2[b][6]=mevcut[b][6];
anahtar2[b][7]=mevcut[b][7];
anahtar2[b][8]='\0';
// printf("%s",mevcut[b]);
f=0;
b=b+1;
}
else
{mevcut[b][f]= birkelime;
f=f+1;
}
} while (birkelime != '\377' ); /* Dosya sonu */
fclose(fp3);
a=a-1;
t=0;
Bul (a,b);
}
int Bul(int a1,int b1)
{
bulunans=0;
int x,y,g;
g=0;
char *de1,*de2;
for (y=0;y<=a1;++y)
{g=0;
for (x=0;x<=b1;++x)
{
// strncpy(de1, anahtar1[y],7);
// strncpy(de2, anahtar1[x], 7);
int i;
i=0;
for(i=0;i<9;++i)
{
if (anahtar2[x][i]=='a') anahtar2[x][i]='A';
if (anahtar2[x][i]=='b') anahtar2[x][i]='B';
if (anahtar2[x][i]=='c') anahtar2[x][i]='C';
if (anahtar2[x][i]=='d') anahtar2[x][i]='D';
if (anahtar2[x][i]=='e') anahtar2[x][i]='E';
if (anahtar2[x][i]=='f') anahtar2[x][i]='F';
}
i=0;
for(i=0;i<9;++i)
{
if (anahtar1[x][i]=='a') anahtar1[x][i]='A';
if (anahtar1[x][i]=='b') anahtar1[x][i]='B';
if (anahtar1[x][i]=='c') anahtar1[x][i]='C';
if (anahtar1[x][i]=='d') anahtar1[x][i]='D';
if (anahtar1[x][i]=='e') anahtar1[x][i]='E';
if (anahtar1[x][i]=='f') anahtar1[x][i]='F';
}
de1=anahtar1[y];
de2=anahtar2[x];
// printf("---------%s---%s \n",de1,de2);
if (strcmp(de1,de2)==0) //iki sitring(po,nter karşılaştır)
{
bulunana1[bulunans]=y;
bulunanb1[bulunans]=x;
bulunans=bulunans+1;
// printf("%d---%d--%d \n",x,y,bulunans);
g=1;
break;
}//if
} //for x
if (g==0)
{
bulunana1[bulunans]=y;
bulunans=bulunans+1;
bulunanb1[bulunans]=0;
g=0;
}
} //for y
}
int Goster(int aralik2)
{int v,aralik,fg;
char *Stoplam;
char *diz1;
char *diz2;
fg=20;
Toplam=0;
v=0;
if (aralik2<0)
aralik2=0;
aralik=aralik2+fg;
if (aralik>bulunans)
{
aralik=bulunans;
}
for(v=aralik2;v<aralik;++v)
{
int ab,ba;
ba= bulunanb1[v];
ab= bulunana1[v];
// diz1=servip[ab];
diz2=mevcut[ba];
/*
char caid[6];
char No[1000][7];
char servip[1000][50];
char card[4];
char at[4];
char hadler[7];
char handlerno[1000][8];
char uphops[6];
char uphopsno[1000][2];
char maxdown[8];
char maxdownno [1000][2];
*/
sprintf( message2[Toplam],"%s %s %s / %s %s / %s --> %s ",No[ab],servip[ab],anahtar1[ab],handlerno[ab],uphopsno[ab],maxdownno[ab],diz2);
// sprintf( message2[Toplam],"%s %s %s/%s %s/%s --> %s ",No[ab],servip[ab],anahtar1[ab],handlerno[ab],uphopsno[ab],maxdownno[ab],diz2);
// printf("%s \n",message2[Toplam]);
Toplam=Toplam+1;
}
}
/*
do {
for (t=0;t<a;t++)
{
system("cp incubusCamdorg incubusCamd.conf");
system("killall -9 incubusCamd.sigma");
printf("%s",server[t]);
DosyaYAZ (server[t]);
system("cp incubusCamd.conf /EMU/OpenXCAS/incubusCamd/incubusCamd.conf");
system("cd /EMU/OpenXCAS/incubusCamd/ && ./incubusCamd.sigma &");
sleep(6);
}
t=0;
} while(1);
*/
int RestatCCcam()
{
system("killall -9 cccam_module &");
system("cd /EMU/OpenXCAS/CCcamCAS/ && ./cccam_module &");
font = GrCreateFont(FONTNAME, 15, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
GrDrawImageToFit(main_window,main _gc,200,100 ,200,50,PopupBox);
GrText(main_window, main_gc, 250 ,125, "CCcam Restating...", -1, GR_TFASCII);
GrDestroyFont(font);
}
static void Resim_Init(void)
{
ResimYukle();
}
int
main(int argc,char **argv)
{
GR_EVENT event;
GR_WM_PROPERTIES props;
int grabResult;
int key = 'a';
int grabKind = GR_GRAB_HOTKEY_EXCLUSIVE;
DosyaOku();
//Ekranla bağlantı kur
if (GrOpen() < 0) {
printf("Can't open graphics\n");
exit(1);
}
/*
int delay;
delay=0;
do {
delay=delay+1;
if (delay>500) {restat=0;
repaintAll();
delay=0;
printf("deneme ... %d \n",delay);
}
} while (1);
*/
/* pass errors through main loop*/
GrSetErrorHandler(NULL);
Resim_Init();
main_window = GrNewWindow(GR_ROOT_WINDOW_ID, 20, 20, WIDTH, HEIGHT,
0, GREEN, RED);
props.flags = GR_WM_FLAGS_PROPS | GR_WM_FLAGS_TITLE;
props.props = GR_WM_PROPS_NOBACKGROUND;
props.title = "Nano-X GrabKey Demo";
GrSetWMProperties(main_window, &props);
main_gc = GrNewGC();
grabResult = GrGrabKey(main_window, key, grabKind);
//printf("%d\n", grabResult);
GrSelectEvents(main_window, GR_EVENT_MASK_EXPOSURE | GR_EVENT_MASK_CLOSE_REQ
| GR_EVENT_MASK_KEY_DOWN | GR_EVENT_MASK_KEY_UP);
GrMapWindow(main_window);
GrSetFocus(main_window);
//GrDrawImageToFit(main_window,main _gc,0, 0,640,480,s_pBgImage); //Arkaplan ekrana yaz
//Basılan Tuşları bul
kartim=0;
for (;;) {
GrGetNextEvent(&event);
switch (event.type)
{
case GR_EVENT_TYPE_EXPOSURE:
repaint(event.exposure.x, event.exposure.y,
event.exposure.width, event.exposure.height);
break;
case GR_EVENT_TYPE_CLOSE_REQ:
GrClose();
exit(0);
break;
case GR_EVENT_TYPE_ERROR:
printf("\7grabdemo: Error (%s) ", event.error.name);
printf(nxErrorStrings[event.error.code],event.error.id);
break;
case GR_EVENT_TYPE_KEY_DOWN:
{
int i;
for(i=0;i<MAX_KEY;i++)
{
if(keys_td210[i].mwkey == event.keystroke.ch)
{
/* sprintf(message1, "%d uuu %03d Keyrrrr %d (%s) scan %d pressed \n",kartim,
getSerialNumber(), event.keystroke.ch,
keys_td210[i].name, event.keystroke.scancode);*/
if (keys_td210[i].name=="MWKEY_UP")
{//key up
kartim=kartim-1;
}
if (keys_td210[i].name=="MWKEY_DOWN")
{//keydown
kartim=kartim+1;
}
if (keys_td210[i].name=="MWKEY_LEFT")
{//key sol
kartim=kartim-10;
}
if (keys_td210[i].name=="MWKEY_RIGHT")
{//key sağ
kartim=kartim+10;
}
if (keys_td210[i].name=="MWKEY_COLORED_KEY_2")
{//key 0
restat=1;
RestatCCcam();
RestatCCcam();
sleep(5);
restat=0;
DosyaOku();
}
if (keys_td210[i].name=="MWKEY_COLORED_KEY_3")
{//key 0
kartim=0;
DosyaOku();
}
break;
}
}
}
if (kartim<0)
{ kartim=0;}font = GrCreateFont(FONTNAME, 15, NULL);
GrSetFontAttr(font, GR_TFANTIALIAS|GR_TFKERNING, 0);
GrSetGCFont(main_gc, font);
Goster(kartim);
repaintAll();
break;
}
}
//basılan tuşları bul son
ResimHafiza();
GrClose();
return 0;
}
Makefile source kode
.SUFFIXES:.c.o
CC = mipsel-linux-gcc
INC = ../include/microwin
LIBS = -L../lib -lnano-X
CFLAGS = -I$(INC)
OBJS = CCcaminfo.o
SRCS = CCcaminfo.c
TARGET = CCcaminfo.bin
all : $(TARGET)
$(TARGET) : $(OBJS)
$(CC) -o $@ $(OBJS) $(LIBS)
clean :
rm -rf $(OBJS) CCcaminfo/CCcaminfo CCcaminfo.plugin plugins.lst
install : $(TARGET)
mv CCcaminfo.bin CCcaminfo
mv CCcaminfo/CCcaminfo.bin CCcaminfo/CCcaminfo
tar -cvzf CCcaminfo.plugin CCcaminfo
echo CCcaminfo > plugins.lst