SlideShare une entreprise Scribd logo
1  sur  46
LARENA3.0 架构与关键技术
                         联芯科技

03/26/12
总体架构
Glib/GObject


 Glib :提供基本数据结构和函数库
 。
  单链表     双链表  哈希表  数组         队列   …
  内存分配    字符串     log      …

Gobject :提供面向对象的支持。
版本: 2.6.6 (裁剪)。
GObject 类概念

typedef struct _GokuApp              GokuApp;
typedef struct _GokuAppClass         GokuAppClass;

struct _GokuApp                    实例结构体
{
   GObject parent_instance;
};

struct _GokuAppClass                  类结构体
{
   GObjectClass parent_class;
   gboolean      (*on_start)(GokuApp *app);
   gboolean      (*on_pause)(GokuApp *app);
   gboolean      (*on_resume)(GokuApp *app);
   gboolean      (*on_stop)(GokuApp *app);
   const gchar * (*get_theme_name)(GokuApp *app);
   const gchar * (*get_language_name)(GokuApp *app);
   void          (*on_activity_type_reg)(GokuApp *app);
   GType         (*get_facade_type)(GokuApp *app);
};
GObject 类继承


typedef struct _GokuCallApp      GokuCallApp;
typedef struct _GokuCallAppClass
GokuCallAppClass;

struct _GokuCallApp             static void goku_call_app_init(GokuCallApp *call)
{                               {
   GokuApp parent;
};                              }

struct _GokuCallAppClass        static void goku_call_app_class_init(GokuCallAppClass *klass)
{                               {
   GokuAppClass parent_class;     GObjectClass *object_class = G_OBJECT_CLASS(klass);
};                                GokuAppClass *app_class = GOKU_APP_CLASS(klass);

                                    object_class->finalize = goku_call_app_finalize;

                                    app_class->on_start = goku_call_app_on_start;
                                    app_class->on_stop = goku_call_app_on_stop;
                                    app_class->on_activity_type_reg = goku_call_app_register_acitivity_type;
                                    app_class->get_facade_type = goku_call_app_get_facade_type;
                                }
Gobject 对象宏

宏
#define GOKU_TYPE_CALL            (goku_call_get_type())
#define GOKU_CALL(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), GOKU_TYPE_CALL, GokuCall))
#define GOKU_CALL_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass), GOKU_TYPE_CALL, GokuCallClass))
#define GOKU_IS_CALL(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GOKU_TYPE_CALL))
#define GOKU_IS_CALL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), GOKU_TYPE_CALL))
#define GOKU_CALL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GOKU_TYPE_CALL, GokuCallClass))




G_DEFINE_TYPE(GokuCall, goku_call, GOKU_TYPE_APP)

goku_call_get_type();
goku_call_init(GokuCall *call);
goku_call_class_init(GokuCallClass *klass);
应用框架

                         GokuApp




                        GokuFacade




         GokuActivity   GokuCommand   GokuService




GokuApp :负责应用启动、恢复、暂停、结束、主题、语言、组件类型注册。
GokuFacade : 负责注册 Command 、 Service 。
M GokuService :负责域逻辑处理。
V GokuActivity : 呈现 UI ,负责处理窗口、控件消息;创建菜单、对话框。
C GokuCommand :负责业务逻辑处理。
GokuApp 类


struct _GokuAppClass
{
   GObjectClass parent_class;

     gboolean (*on_start)(GokuApp *app);

     gboolean (*on_pause)(GokuApp *app);

     gboolean (*on_resume)(GokuApp *app);

     gboolean (*on_stop)(GokuApp *app);

     const gchar *(*get_theme_name)(GokuApp *app);

     const gchar *(*get_language_name)(GokuApp *app);

     void (*on_activity_type_reg)(GokuApp *app);

     GType (*get_facade_type)(GokuApp *app);
};
GokuActivity 类


与用户交互的对象
负责建立窗口及子窗口
负责 UI 消息的处理
负责旋屏的处理
GokuActivity 创建


static void goku_demo_activity_class_init(GokuDemoActivityClass *klass)
{
      GOKU_ACTIVITY_CLASS(klass)->on_create = goku_demo_activity_on_create;
}


void goku_demo_activity_on_create(GokuActivity *activity, GokuIntent * intent )
{
     HWND ctrl_static = HWND_INVALID;
     const gchar *text = resources_get_string_by_id(IDS_STATIC);

     goku_activity_set_layout_id(activity, IDL_LAYOUT_DEMO);

     ctrl_static = goku_activity_get_wnd_by_id(activity, IDC_STATIC_TEXT);
     control_static_set_text(ctrl_static, text);
}
demo_resource.h


 #define IDS_STATIC               0x00000001
 #define IDS_SKB_BACK             0x00000002
 #define IDL_LAYOUT_DEMO         0x00000003
 #define IDL_POPMENU              0x00000004
 #define IDC_STATIC_TEXT          0x00000005
 #define IDC_TITLEBAR            0x00000006
 #define IDS_DEMO                0x00000007
 #define IDF_IMAGE_DEMO          0x00000008



resource.h 是由 UI Designer 自动生成的头文件
IDL_ 表示布局文件索引值
IDC_ 表示控件索引值
IDS_ 表示字符串索引值
IDF_ 表示文件路径索引值
layout.xml

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<LAYOUTWINDOW FillColor="255 255 255" Id="IDL_LAYOUT_DEMO">
       <LINEARLAYOUT Name="ID_LINEARLAYOUT_TITLEBAR_CONTACT_ALL" Orientation="Vertical">
              <TITLEBAR Name="IDC_TITLEBAR" Height="38" LayoutId="IDL_SYSTEM_TITLEBAR_SIMPLE"/>
              <STATIC Name="IDC_STATIC_TEXT" AlignHorizontal="Center" FillColor="255 255 255">
                     <TEXT FontSize="20" AlignHorizontal="Center" AlignVertical="Center"/>
              </STATIC>
       </LINEARLAYOUT>
</LAYOUTWINDOW>
Activity 与 Layout




Activity              1-1                           ID


                                  Layout.xml

   1-1


Window Proc     goku_activity_set_layout_id(activity, IDL_DIALER);
GokuActivity 注册



goku_demo_app.c 片段

static void goku_demo_class_init(GokuDemoAppClass *klass)
{
  GokuAppClass *app_class = GOKU_APP_CLASS(klass);

    app_class->on_activity_type_reg = goku_demo_register_acitivity_type;
}

static void goku_demo_register_acitivity_type(GokuApp *app)
{
       GOKU_TYPE_DEMO_APP_ACTIVITY; //goku_demo_app_activity_get_type();
}
Notification 组件间交互


goku_call_notification.h

#define NOTI_START_SERVICE       "NOTIFY_START_SERVICE"
#define NOTI_STOP_SERVICE        "NOTIFY_STOP_SERVICE“



  一个 Notification 用一个字符串表示
  只在应用线程内有效
  Activity 接收或触发一个 Command
Notification 发送与接收


void goku_mvc_send_notification(const gchar *notification_name);
void goku_mvc_send_notification_with_body(const gchar *notification_name, gconstpointer body);




goku_call_activity.c 片段

void goku_call_activity_handle_notification( GokuIMediator *imediator, GokuINotification *inotification )
{
      const gchar *noti_name = goku_inotification_get_name(inotification);
       if (g_str_equal(noti_name, NOTI_CALL_RETRIEVED_IND))
      {
              …
      }
      else if (g_str_equal(noti_name, NOTI_CALL_TRANSFER_IND))
      {
              …
      }
}
Activity 中注册感兴趣的 Notification


void goku_call_activity_imediator_interface_init( GokuIMediatorClass *iface )
{
      iface->list_notification_interests = goku_call_activity_list_notification_interests;
      iface->handle_notification = goku_call_activity_handle_notification;
}

GList * goku_call_activity_list_notification_interests(GokuIMediator *imediator)
{
  GList * noti_list = NULL;
  noti_list = g_list_append(list, NOTI_CALL_RETRIEVED_IND);
  noti_list = g_list_append(list, NOTI_CALL_TRANSFER_IND);

    return noti_list;
}
Command 类

struct _GokuSimpleCommandClass
{
      GokuNotifierClass parent_class;

     void (*execute)(GokuSimpleCommand *icommand, GokuINotification *inotification);
};




由 Notification 触发
处理复杂的操作或业务逻辑
降低 Activity 与 Service 之间的耦合
在 Notification 发生后生成实例, execute 函数返回后被实例销毁
Command 与 Notification


Activity

           Notification
                                                                  Activity
                                                   Notification
Service
           Notification
                                  Facade                          Service
           Notification
Command                                              Execute

           Notification                                           Command

  Any
Command 类注册

static void goku_call_facade_initialize_controller(GokuFacade *facade)
{
   GokuIFacade *ifacade = GOKU_IFACADE(facade);
   GOKU_FACADE_CLASS(goku_call_facade_parent_class)->initialize_controller(facade);

    goku_ifacade_register_command(ifacade , NOTI_INCOMING_CALL,    GOKU_TYPE_INCOMING_CALL_COMMAND);
    goku_ifacade_register_command(ifacade , NOTI_DIAL,             GOKU_TYPE_CALL_DIAL_COMMAND);
    goku_ifacade_register_command(ifacade , NOTI_ANSWER,           GOKU_TYPE_CALL_ANSWER_COMMAND);
}


    由 GokuFacade 类注册
    Notification 与 Command 的 Type 对应
    多个 Notification 可以对应一种 Command
GokuService 类


管理应用数据
负责域逻辑
与 Larena Platform 组件交互
接收通道消息
只有调用 goku_start_service 后才能接收消息
GokuService 通过抛出 Notification 通知使用者
不在 MVC 架构中使用者可使用 CALLBACK 方式代替 Notification
GokuService 通道消息处理

注册感兴趣的消息
static GList * goku_call_service_get_interested_msgs(GokuService *service)
{
   GList * msgs = NULL;
   msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_DIAL_RESULT));
   msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_ANSWER_RESULT));
   msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_REMOTE_HANGUP));
   msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_PROGRESS_IND));

    return msgs;
}

处理消息
static void goku_call_service_on_msg(GokuService * service, gint msg, gconstpointer data, guint size)
{

      switch (msg)
      {
      case TPM_CALL_DIAL_RESULT:
            …
            break;
      }
}
GokuService 注册和使用

 创建和注册 Service
 void goku_call_facade_initialize_model( GokuFacade *facade )
 {
   GokuCallService *call_service;

     GOKU_FACADE_CLASS(goku_call_facade_parent_class)->initialize_model(facade);

     call_service = goku_call_service_new();
     goku_ifacade_register_proxy(GOKU_IFACADE(facade), GOKU_IPROXY(call_service ));
     ….
 }




在 Command 中使用 Facade
static void goku_call_dial_command_execute(GokuSimpleCommand *icommand, GokuINotification *inotification)
{
    GokuCallService * service = GOKU_CALL_SERVICE(goku_mvc_retrieve_proxy(GOKU_CALL_SERVICE_NAME));
    …
    goku_call_service_create_call(service, number, NULL, 0);
}
GokuFacade


注册 Notification 和 Command 的对应关系
注册 Service
框架中提供的 Service



通过 service 名称创建
contact_service = goku_service_create(GOKU_CONTACT_SERVICE_NAME);

在应用线程中执行
可以使用 Service 提供的 API
可以处理 Service 抛出的 Notification
Intent


Intent 类似于 Notification
Intent 将由系统选择最合适的应用程序处理
向系统表达你的 Intent( 意图)
查看图片、打电话都是意图
框架定义了一系列 Intent
Intent


拨打电话 Intent
  GokuIntent *intent = goku_intent_new_from_action(“GokuIntentActionCall”);
  goku_value_set_put_string(intent->extras, "number", “13999999999”);
  goku_activity_start_activity(activity, intent);
manifest.xml


每个应用都有一个 manifest.xml 文件
manifest 声明应用类名称 (GokuApp 结构体 ) 、应用 ID 、应用名称、应用图标
manifest 声明 activity 类名称, activity 图标、 activity 处理的 Intent

  call application manifest.xml
  <?xml version="1.0" encoding="utf-8"?>
  <application
    class="GokuCall"
    id="0x6303"
    name="IDS_VOICE_CALL"
    res="applications/call"
    small_icon ="call.png">

  <activity class="GokuCallActivity"
            name="IDS_VOICE_CALL"
            action="GokuIntentActionCall"
            launch_mode="singleTask"
            small_icon ="call.png"/>
  </application>
Manager


Manager 是一个开机时启动,常驻后台的应用
Manager 一般没有界面, Notification Manager 除外
Manager 一般会发布 Service
Manager 中的 C/S 通信模型


                                         GokuService




               GokuServerService                       GokuClientService

                on_client_connect()                     on_connected()
                on_client_disconnect()                  on_disconnected()
                on_client_request()                     on_receive()




GokuServerService 和 GokuClientService 都是一种 Service
GokuServerService 运行在 Manager 线程中
GokuClientService 运行在 Application/Manager 线程中
GokuClientService 提供 API
GokuServerService 和 GokuClientService 都可以抛出 Notification
Manager 的使用

       Program Application Thread                                Package Manager Thread                  HomeScreen Thread


Activity       Command            GokuPackag                PacageMgr                 PackageMgr          GokuPackag
                                   eService                ServerService             InstallCommand        eService

     1: Notification

                       2: Install Package



                                            3: Install Message

                                                                        4: Notification

                                             5: Install Result

                                                                                     6: Install Result

               7: Notification
Activity Manager

           Call
           Intent

                          Home Screen         Dialer            Call
 Dialer
 Intent
                       main menu activity   dialer activity   call activity



Activity
                Task
Manager
Resources

 APP1                                       APP2

                         ID



                     Resources




            Layout                 Layout
            Theme                  Theme
            Image                  Image
            String                 String



                     File System

BITMAP* resources_get_image_by_id(UINT32 id);
CONST CHAR* resources_get_string_by_id(UINT32 id);
资源智能选取


                                             240x320
240x320              320x480
                                            landscape


                  Resources

                                                        LCDInfo

          image                    layout

资    image-320X480             layout-320X480
源
文    image-landscape           layout-240X320
件
夹                               layout-
                           landscape-240X32
                                   0
Theme

Theme :描绘所有支持的控件的主题信息

<EDIT BgType="ImageFile" SizingType="Stretch" SizingMargins="0 2 0 2"
ImageFile="image/edit.png" ImageCount="2" ImageLayout="Vertical"
FillColor="255 255 255" BorderColor="0 0 0" BorderSize=""
ContentMargins="4 0 0 0" />
布局


LinearLayout
线性布局所有对象成行或列,即所有对象穿成串。
TableLayout
将界面元素按行、列排列。一个表布局含有几个 TableRow 对象,
 每个 TableRow 即是一个水平方向的线性布局。
AbsoluteLayout
窗口元素按照指定的确切( x, y )坐标,并把自己显示在该位置。
RelativeLayout
允许窗口元素根据其他元素的相对位置,或者是和父亲布局的相对
 位置来确定自身位置。

以上四种布局可以嵌套使用,宽度、高度和各种间距均可采用相对
值(即百分比)以达到开发者快速开发以及绝对适配屏幕分辨率的
要求。
线性布局
相对布局
表布局
表布局
布局嵌套及分辨率适配


支持横屏旋转及分辨率改变




                        400X240
 240X400
布局嵌套及分辨率适配
控件
控件响应

        在 Activity 中重载 on_layout_wnd_proc 函数

        activity_class->on_layout_wnd_proc = goku_demo_activity_proc;


gint goku_demo_activity_proc(GokuActivity *activity, HWND hWnd, gint msg, guint wParam, gulong lParam)
{
   switch (msg)
   {
   case MSG_KEYDOWN:
      {
        switch ( wParam )
        {
            case KEY_RSK:
               goku_activity_finish_activity(activity);
                break;

               case KEY_LSK:
                   goku_activity_popmenu_create(activity, IDL_POPMENU, GOKU_POPMENU_FROM_BOTTOM);
                   break;
           }
         }
         break;
    }

           return DefaultMainWinProc(hWnd, msg, wParam, lParam);
}
LOG 与调试


Glib 提供丰富的 LOG 接口,包括对象类型判断、断言、返回判断;
可重定向的 LOG 输出,控制台、文件、网络;
可按应用进行 LOG 分类输出
对象泄漏检测,在应用退出时可检测应用中的泄漏,并输出分配调用栈;
谢谢您的关注

Contenu connexe

Tendances

IP project for class 12 cbse
IP project for class 12 cbseIP project for class 12 cbse
IP project for class 12 cbsesiddharthjha34
 
Stay with React.js in 2020
Stay with React.js in 2020Stay with React.js in 2020
Stay with React.js in 2020Jerry Liao
 
RxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниRxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниStfalcon Meetups
 
Android Wear – IO Extended
Android Wear – IO ExtendedAndroid Wear – IO Extended
Android Wear – IO ExtendedDouglas Drumond
 
Google Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleGoogle Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleMathias Seguy
 
ProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and TricksProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and Tricksnetomi
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android OKirill Rozov
 
The Ring programming language version 1.10 book - Part 95 of 212
The Ring programming language version 1.10 book - Part 95 of 212The Ring programming language version 1.10 book - Part 95 of 212
The Ring programming language version 1.10 book - Part 95 of 212Mahmoud Samir Fayed
 
JAVA AND MYSQL QUERIES
JAVA AND MYSQL QUERIES JAVA AND MYSQL QUERIES
JAVA AND MYSQL QUERIES Aditya Shah
 
Model-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive TransformationModel-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive TransformationEelco Visser
 
The Ring programming language version 1.5.2 book - Part 67 of 181
The Ring programming language version 1.5.2 book - Part 67 of 181The Ring programming language version 1.5.2 book - Part 67 of 181
The Ring programming language version 1.5.2 book - Part 67 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189Mahmoud Samir Fayed
 
How Reactive do we need to be
How Reactive do we need to beHow Reactive do we need to be
How Reactive do we need to beJana Karceska
 
ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)Kenji Sakashita
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
 

Tendances (20)

IP project for class 12 cbse
IP project for class 12 cbseIP project for class 12 cbse
IP project for class 12 cbse
 
Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto
 
Library management system
Library management systemLibrary management system
Library management system
 
Stay with React.js in 2020
Stay with React.js in 2020Stay with React.js in 2020
Stay with React.js in 2020
 
RxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниRxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камни
 
GMock framework
GMock frameworkGMock framework
GMock framework
 
Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 
Android Wear – IO Extended
Android Wear – IO ExtendedAndroid Wear – IO Extended
Android Wear – IO Extended
 
Google Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleGoogle Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification Google
 
ProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and TricksProGuard / DexGuard Tips and Tricks
ProGuard / DexGuard Tips and Tricks
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android O
 
The Ring programming language version 1.10 book - Part 95 of 212
The Ring programming language version 1.10 book - Part 95 of 212The Ring programming language version 1.10 book - Part 95 of 212
The Ring programming language version 1.10 book - Part 95 of 212
 
JAVA AND MYSQL QUERIES
JAVA AND MYSQL QUERIES JAVA AND MYSQL QUERIES
JAVA AND MYSQL QUERIES
 
Model-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive TransformationModel-Driven Software Development - Context-Sensitive Transformation
Model-Driven Software Development - Context-Sensitive Transformation
 
Solid principles
Solid principlesSolid principles
Solid principles
 
The Ring programming language version 1.5.2 book - Part 67 of 181
The Ring programming language version 1.5.2 book - Part 67 of 181The Ring programming language version 1.5.2 book - Part 67 of 181
The Ring programming language version 1.5.2 book - Part 67 of 181
 
The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189
 
How Reactive do we need to be
How Reactive do we need to beHow Reactive do we need to be
How Reactive do we need to be
 
ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)ハンズオン資料 電話を作ろう(v2.x用)
ハンズオン資料 電話を作ろう(v2.x用)
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
 

En vedette

Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8Fit47Chic
 
Karla jackson4 hw499-01-project4
Karla jackson4 hw499-01-project4Karla jackson4 hw499-01-project4
Karla jackson4 hw499-01-project4Fit47Chic
 
Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)
Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)
Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)hik_lhz
 
Developments in linux
Developments in linuxDevelopments in linux
Developments in linuxhik_lhz
 
Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8Fit47Chic
 
0 mq the guide
0 mq   the guide0 mq   the guide
0 mq the guidehik_lhz
 
Karla jackson4 hw499-01-project5
Karla jackson4 hw499-01-project5Karla jackson4 hw499-01-project5
Karla jackson4 hw499-01-project5Fit47Chic
 

En vedette (8)

Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8
 
Karla jackson4 hw499-01-project4
Karla jackson4 hw499-01-project4Karla jackson4 hw499-01-project4
Karla jackson4 hw499-01-project4
 
Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)
Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)
Linux集群应用实战 通过lvs+keepalived搭建高可用的负载均衡集群系统(第二讲)
 
Developments in linux
Developments in linuxDevelopments in linux
Developments in linux
 
Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8Karla jackson4 hw499-01-project8
Karla jackson4 hw499-01-project8
 
0 mq the guide
0 mq   the guide0 mq   the guide
0 mq the guide
 
Cloud learning
Cloud learningCloud learning
Cloud learning
 
Karla jackson4 hw499-01-project5
Karla jackson4 hw499-01-project5Karla jackson4 hw499-01-project5
Karla jackson4 hw499-01-project5
 

Similaire à Larena3 0架构与关键技术

Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02rhemsolutions
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFPierre-Yves Ricau
 
Thomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-finalThomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-finalDroidcon Berlin
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257newegg
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinXamarin
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developersPavel Lahoda
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon Berlin
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
重構—改善既有程式的設計(chapter 8)part 2
重構—改善既有程式的設計(chapter 8)part 2重構—改善既有程式的設計(chapter 8)part 2
重構—改善既有程式的設計(chapter 8)part 2Chris Huang
 
LinkedIn TBC JavaScript 100: Functions
 LinkedIn TBC JavaScript 100: Functions LinkedIn TBC JavaScript 100: Functions
LinkedIn TBC JavaScript 100: FunctionsAdam Crabtree
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializableSourabh Sahu
 
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014First Tuesday Bergen
 
Native Payment - Part 3.pdf
Native Payment - Part 3.pdfNative Payment - Part 3.pdf
Native Payment - Part 3.pdfShaiAlmog1
 

Similaire à Larena3 0架构与关键技术 (20)

Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SF
 
Thomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-finalThomas braun dependency-injection_with_robo_guice-presentation-final
Thomas braun dependency-injection_with_robo_guice-presentation-final
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257
 
DIY Uber
DIY UberDIY Uber
DIY Uber
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developers
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahoda
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Ngrx meta reducers
Ngrx meta reducersNgrx meta reducers
Ngrx meta reducers
 
All things that are not code
All things that are not codeAll things that are not code
All things that are not code
 
重構—改善既有程式的設計(chapter 8)part 2
重構—改善既有程式的設計(chapter 8)part 2重構—改善既有程式的設計(chapter 8)part 2
重構—改善既有程式的設計(chapter 8)part 2
 
LinkedIn TBC JavaScript 100: Functions
 LinkedIn TBC JavaScript 100: Functions LinkedIn TBC JavaScript 100: Functions
LinkedIn TBC JavaScript 100: Functions
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializable
 
Flutter
FlutterFlutter
Flutter
 
Dependency Injection for Android
Dependency Injection for AndroidDependency Injection for Android
Dependency Injection for Android
 
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
 
Native Payment - Part 3.pdf
Native Payment - Part 3.pdfNative Payment - Part 3.pdf
Native Payment - Part 3.pdf
 

Plus de hik_lhz

Log4c developersguide
Log4c developersguideLog4c developersguide
Log4c developersguidehik_lhz
 
D bus specification
D bus specificationD bus specification
D bus specificationhik_lhz
 
自动生成 Makefile 的全过程详解!
自动生成 Makefile 的全过程详解!自动生成 Makefile 的全过程详解!
自动生成 Makefile 的全过程详解!hik_lhz
 
Considerations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfConsiderations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfhik_lhz
 
8 集群
8 集群8 集群
8 集群hik_lhz
 
Memcached内存分析、调优、集群
Memcached内存分析、调优、集群Memcached内存分析、调优、集群
Memcached内存分析、调优、集群hik_lhz
 

Plus de hik_lhz (6)

Log4c developersguide
Log4c developersguideLog4c developersguide
Log4c developersguide
 
D bus specification
D bus specificationD bus specification
D bus specification
 
自动生成 Makefile 的全过程详解!
自动生成 Makefile 的全过程详解!自动生成 Makefile 的全过程详解!
自动生成 Makefile 的全过程详解!
 
Considerations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfConsiderations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmf
 
8 集群
8 集群8 集群
8 集群
 
Memcached内存分析、调优、集群
Memcached内存分析、调优、集群Memcached内存分析、调优、集群
Memcached内存分析、调优、集群
 

Dernier

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Larena3 0架构与关键技术

  • 1. LARENA3.0 架构与关键技术 联芯科技 03/26/12
  • 3. Glib/GObject Glib :提供基本数据结构和函数库 。 单链表 双链表 哈希表 数组 队列 … 内存分配 字符串 log … Gobject :提供面向对象的支持。 版本: 2.6.6 (裁剪)。
  • 4. GObject 类概念 typedef struct _GokuApp GokuApp; typedef struct _GokuAppClass GokuAppClass; struct _GokuApp 实例结构体 { GObject parent_instance; }; struct _GokuAppClass 类结构体 { GObjectClass parent_class; gboolean (*on_start)(GokuApp *app); gboolean (*on_pause)(GokuApp *app); gboolean (*on_resume)(GokuApp *app); gboolean (*on_stop)(GokuApp *app); const gchar * (*get_theme_name)(GokuApp *app); const gchar * (*get_language_name)(GokuApp *app); void (*on_activity_type_reg)(GokuApp *app); GType (*get_facade_type)(GokuApp *app); };
  • 5. GObject 类继承 typedef struct _GokuCallApp GokuCallApp; typedef struct _GokuCallAppClass GokuCallAppClass; struct _GokuCallApp static void goku_call_app_init(GokuCallApp *call) { { GokuApp parent; }; } struct _GokuCallAppClass static void goku_call_app_class_init(GokuCallAppClass *klass) { { GokuAppClass parent_class; GObjectClass *object_class = G_OBJECT_CLASS(klass); }; GokuAppClass *app_class = GOKU_APP_CLASS(klass); object_class->finalize = goku_call_app_finalize; app_class->on_start = goku_call_app_on_start; app_class->on_stop = goku_call_app_on_stop; app_class->on_activity_type_reg = goku_call_app_register_acitivity_type; app_class->get_facade_type = goku_call_app_get_facade_type; }
  • 6. Gobject 对象宏 宏 #define GOKU_TYPE_CALL (goku_call_get_type()) #define GOKU_CALL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GOKU_TYPE_CALL, GokuCall)) #define GOKU_CALL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GOKU_TYPE_CALL, GokuCallClass)) #define GOKU_IS_CALL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GOKU_TYPE_CALL)) #define GOKU_IS_CALL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GOKU_TYPE_CALL)) #define GOKU_CALL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GOKU_TYPE_CALL, GokuCallClass)) G_DEFINE_TYPE(GokuCall, goku_call, GOKU_TYPE_APP) goku_call_get_type(); goku_call_init(GokuCall *call); goku_call_class_init(GokuCallClass *klass);
  • 7. 应用框架 GokuApp GokuFacade GokuActivity GokuCommand GokuService GokuApp :负责应用启动、恢复、暂停、结束、主题、语言、组件类型注册。 GokuFacade : 负责注册 Command 、 Service 。 M GokuService :负责域逻辑处理。 V GokuActivity : 呈现 UI ,负责处理窗口、控件消息;创建菜单、对话框。 C GokuCommand :负责业务逻辑处理。
  • 8. GokuApp 类 struct _GokuAppClass { GObjectClass parent_class; gboolean (*on_start)(GokuApp *app); gboolean (*on_pause)(GokuApp *app); gboolean (*on_resume)(GokuApp *app); gboolean (*on_stop)(GokuApp *app); const gchar *(*get_theme_name)(GokuApp *app); const gchar *(*get_language_name)(GokuApp *app); void (*on_activity_type_reg)(GokuApp *app); GType (*get_facade_type)(GokuApp *app); };
  • 10. GokuActivity 创建 static void goku_demo_activity_class_init(GokuDemoActivityClass *klass) { GOKU_ACTIVITY_CLASS(klass)->on_create = goku_demo_activity_on_create; } void goku_demo_activity_on_create(GokuActivity *activity, GokuIntent * intent ) { HWND ctrl_static = HWND_INVALID; const gchar *text = resources_get_string_by_id(IDS_STATIC); goku_activity_set_layout_id(activity, IDL_LAYOUT_DEMO); ctrl_static = goku_activity_get_wnd_by_id(activity, IDC_STATIC_TEXT); control_static_set_text(ctrl_static, text); }
  • 11. demo_resource.h #define IDS_STATIC 0x00000001 #define IDS_SKB_BACK 0x00000002 #define IDL_LAYOUT_DEMO 0x00000003 #define IDL_POPMENU 0x00000004 #define IDC_STATIC_TEXT 0x00000005 #define IDC_TITLEBAR 0x00000006 #define IDS_DEMO 0x00000007 #define IDF_IMAGE_DEMO 0x00000008 resource.h 是由 UI Designer 自动生成的头文件 IDL_ 表示布局文件索引值 IDC_ 表示控件索引值 IDS_ 表示字符串索引值 IDF_ 表示文件路径索引值
  • 12. layout.xml <?xml version="1.0" encoding="utf-8" standalone="yes"?> <LAYOUTWINDOW FillColor="255 255 255" Id="IDL_LAYOUT_DEMO"> <LINEARLAYOUT Name="ID_LINEARLAYOUT_TITLEBAR_CONTACT_ALL" Orientation="Vertical"> <TITLEBAR Name="IDC_TITLEBAR" Height="38" LayoutId="IDL_SYSTEM_TITLEBAR_SIMPLE"/> <STATIC Name="IDC_STATIC_TEXT" AlignHorizontal="Center" FillColor="255 255 255"> <TEXT FontSize="20" AlignHorizontal="Center" AlignVertical="Center"/> </STATIC> </LINEARLAYOUT> </LAYOUTWINDOW>
  • 13. Activity 与 Layout Activity 1-1 ID Layout.xml 1-1 Window Proc goku_activity_set_layout_id(activity, IDL_DIALER);
  • 14. GokuActivity 注册 goku_demo_app.c 片段 static void goku_demo_class_init(GokuDemoAppClass *klass) { GokuAppClass *app_class = GOKU_APP_CLASS(klass); app_class->on_activity_type_reg = goku_demo_register_acitivity_type; } static void goku_demo_register_acitivity_type(GokuApp *app) { GOKU_TYPE_DEMO_APP_ACTIVITY; //goku_demo_app_activity_get_type(); }
  • 15. Notification 组件间交互 goku_call_notification.h #define NOTI_START_SERVICE "NOTIFY_START_SERVICE" #define NOTI_STOP_SERVICE "NOTIFY_STOP_SERVICE“ 一个 Notification 用一个字符串表示 只在应用线程内有效 Activity 接收或触发一个 Command
  • 16. Notification 发送与接收 void goku_mvc_send_notification(const gchar *notification_name); void goku_mvc_send_notification_with_body(const gchar *notification_name, gconstpointer body); goku_call_activity.c 片段 void goku_call_activity_handle_notification( GokuIMediator *imediator, GokuINotification *inotification ) { const gchar *noti_name = goku_inotification_get_name(inotification); if (g_str_equal(noti_name, NOTI_CALL_RETRIEVED_IND)) { … } else if (g_str_equal(noti_name, NOTI_CALL_TRANSFER_IND)) { … } }
  • 17. Activity 中注册感兴趣的 Notification void goku_call_activity_imediator_interface_init( GokuIMediatorClass *iface ) { iface->list_notification_interests = goku_call_activity_list_notification_interests; iface->handle_notification = goku_call_activity_handle_notification; } GList * goku_call_activity_list_notification_interests(GokuIMediator *imediator) { GList * noti_list = NULL; noti_list = g_list_append(list, NOTI_CALL_RETRIEVED_IND); noti_list = g_list_append(list, NOTI_CALL_TRANSFER_IND); return noti_list; }
  • 18. Command 类 struct _GokuSimpleCommandClass { GokuNotifierClass parent_class; void (*execute)(GokuSimpleCommand *icommand, GokuINotification *inotification); }; 由 Notification 触发 处理复杂的操作或业务逻辑 降低 Activity 与 Service 之间的耦合 在 Notification 发生后生成实例, execute 函数返回后被实例销毁
  • 19. Command 与 Notification Activity Notification Activity Notification Service Notification Facade Service Notification Command Execute Notification Command Any
  • 20. Command 类注册 static void goku_call_facade_initialize_controller(GokuFacade *facade) { GokuIFacade *ifacade = GOKU_IFACADE(facade); GOKU_FACADE_CLASS(goku_call_facade_parent_class)->initialize_controller(facade); goku_ifacade_register_command(ifacade , NOTI_INCOMING_CALL, GOKU_TYPE_INCOMING_CALL_COMMAND); goku_ifacade_register_command(ifacade , NOTI_DIAL, GOKU_TYPE_CALL_DIAL_COMMAND); goku_ifacade_register_command(ifacade , NOTI_ANSWER, GOKU_TYPE_CALL_ANSWER_COMMAND); } 由 GokuFacade 类注册 Notification 与 Command 的 Type 对应 多个 Notification 可以对应一种 Command
  • 21. GokuService 类 管理应用数据 负责域逻辑 与 Larena Platform 组件交互 接收通道消息 只有调用 goku_start_service 后才能接收消息 GokuService 通过抛出 Notification 通知使用者 不在 MVC 架构中使用者可使用 CALLBACK 方式代替 Notification
  • 22. GokuService 通道消息处理 注册感兴趣的消息 static GList * goku_call_service_get_interested_msgs(GokuService *service) { GList * msgs = NULL; msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_DIAL_RESULT)); msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_ANSWER_RESULT)); msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_REMOTE_HANGUP)); msgs = g_list_append(msgs, GINT_TO_POINTER(TPM_CALL_PROGRESS_IND)); return msgs; } 处理消息 static void goku_call_service_on_msg(GokuService * service, gint msg, gconstpointer data, guint size) { switch (msg) { case TPM_CALL_DIAL_RESULT: … break; } }
  • 23. GokuService 注册和使用 创建和注册 Service void goku_call_facade_initialize_model( GokuFacade *facade ) { GokuCallService *call_service; GOKU_FACADE_CLASS(goku_call_facade_parent_class)->initialize_model(facade); call_service = goku_call_service_new(); goku_ifacade_register_proxy(GOKU_IFACADE(facade), GOKU_IPROXY(call_service )); …. } 在 Command 中使用 Facade static void goku_call_dial_command_execute(GokuSimpleCommand *icommand, GokuINotification *inotification) { GokuCallService * service = GOKU_CALL_SERVICE(goku_mvc_retrieve_proxy(GOKU_CALL_SERVICE_NAME)); … goku_call_service_create_call(service, number, NULL, 0); }
  • 24. GokuFacade 注册 Notification 和 Command 的对应关系 注册 Service
  • 25. 框架中提供的 Service 通过 service 名称创建 contact_service = goku_service_create(GOKU_CONTACT_SERVICE_NAME); 在应用线程中执行 可以使用 Service 提供的 API 可以处理 Service 抛出的 Notification
  • 26. Intent Intent 类似于 Notification Intent 将由系统选择最合适的应用程序处理 向系统表达你的 Intent( 意图) 查看图片、打电话都是意图 框架定义了一系列 Intent
  • 27. Intent 拨打电话 Intent GokuIntent *intent = goku_intent_new_from_action(“GokuIntentActionCall”); goku_value_set_put_string(intent->extras, "number", “13999999999”); goku_activity_start_activity(activity, intent);
  • 28. manifest.xml 每个应用都有一个 manifest.xml 文件 manifest 声明应用类名称 (GokuApp 结构体 ) 、应用 ID 、应用名称、应用图标 manifest 声明 activity 类名称, activity 图标、 activity 处理的 Intent call application manifest.xml <?xml version="1.0" encoding="utf-8"?> <application class="GokuCall" id="0x6303" name="IDS_VOICE_CALL" res="applications/call" small_icon ="call.png"> <activity class="GokuCallActivity" name="IDS_VOICE_CALL" action="GokuIntentActionCall" launch_mode="singleTask" small_icon ="call.png"/> </application>
  • 30. Manager 中的 C/S 通信模型 GokuService GokuServerService GokuClientService on_client_connect() on_connected() on_client_disconnect() on_disconnected() on_client_request() on_receive() GokuServerService 和 GokuClientService 都是一种 Service GokuServerService 运行在 Manager 线程中 GokuClientService 运行在 Application/Manager 线程中 GokuClientService 提供 API GokuServerService 和 GokuClientService 都可以抛出 Notification
  • 31. Manager 的使用 Program Application Thread Package Manager Thread HomeScreen Thread Activity Command GokuPackag PacageMgr PackageMgr GokuPackag eService ServerService InstallCommand eService 1: Notification 2: Install Package 3: Install Message 4: Notification 5: Install Result 6: Install Result 7: Notification
  • 32. Activity Manager Call Intent Home Screen Dialer Call Dialer Intent main menu activity dialer activity call activity Activity Task Manager
  • 33. Resources APP1 APP2 ID Resources Layout Layout Theme Theme Image Image String String File System BITMAP* resources_get_image_by_id(UINT32 id); CONST CHAR* resources_get_string_by_id(UINT32 id);
  • 34. 资源智能选取 240x320 240x320 320x480 landscape Resources LCDInfo image layout 资 image-320X480 layout-320X480 源 文 image-landscape layout-240X320 件 夹 layout- landscape-240X32 0
  • 35. Theme Theme :描绘所有支持的控件的主题信息 <EDIT BgType="ImageFile" SizingType="Stretch" SizingMargins="0 2 0 2" ImageFile="image/edit.png" ImageCount="2" ImageLayout="Vertical" FillColor="255 255 255" BorderColor="0 0 0" BorderSize="" ContentMargins="4 0 0 0" />
  • 36. 布局 LinearLayout 线性布局所有对象成行或列,即所有对象穿成串。 TableLayout 将界面元素按行、列排列。一个表布局含有几个 TableRow 对象, 每个 TableRow 即是一个水平方向的线性布局。 AbsoluteLayout 窗口元素按照指定的确切( x, y )坐标,并把自己显示在该位置。 RelativeLayout 允许窗口元素根据其他元素的相对位置,或者是和父亲布局的相对 位置来确定自身位置。 以上四种布局可以嵌套使用,宽度、高度和各种间距均可采用相对 值(即百分比)以达到开发者快速开发以及绝对适配屏幕分辨率的 要求。
  • 44. 控件响应 在 Activity 中重载 on_layout_wnd_proc 函数 activity_class->on_layout_wnd_proc = goku_demo_activity_proc; gint goku_demo_activity_proc(GokuActivity *activity, HWND hWnd, gint msg, guint wParam, gulong lParam) { switch (msg) { case MSG_KEYDOWN: { switch ( wParam ) { case KEY_RSK: goku_activity_finish_activity(activity); break; case KEY_LSK: goku_activity_popmenu_create(activity, IDL_POPMENU, GOKU_POPMENU_FROM_BOTTOM); break; } } break; } return DefaultMainWinProc(hWnd, msg, wParam, lParam); }
  • 45. LOG 与调试 Glib 提供丰富的 LOG 接口,包括对象类型判断、断言、返回判断; 可重定向的 LOG 输出,控制台、文件、网络; 可按应用进行 LOG 分类输出 对象泄漏检测,在应用退出时可检测应用中的泄漏,并输出分配调用栈;