Fix incorrect defaultValue in generated server.hpp

In property.py, the defaultValue is got from yaml and it could be
string, bool, or numeric.

In case of bool, the value becomes True/False, and when it is rendered
in C++ code, the code will not compile due to C++ expects true/false
instead.

And in server.hpp template, it checks "if p.defaultValue", and if the
default value is "false" or 0, p.defaultValue becomes False, so the
generated C++ code will not have default value.

For example, a var defined in yaml has below default value:

    default: true
    default: false
    default: 0

will be rendered in C++ code as:

    var = True;
    var{};
    var{};

This commit fixes the issue by converting defaultValue from True/False
to true/false string, and check if by "if p.defaultValue is not None".

Tested: Verify the above exmaple will generate valid C++ code as below:
            var = true;
            var = false;
            var = 0;

Change-Id: I65c9f5222aa2d7b53299a53ff63d33bd6d073b95
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/tools/sdbusplus/property.py b/tools/sdbusplus/property.py
index 33c7e25..c74754d 100644
--- a/tools/sdbusplus/property.py
+++ b/tools/sdbusplus/property.py
@@ -11,6 +11,12 @@
         self.flags = kwargs.pop('flags', [])
         self.errors = kwargs.pop('errors', [])
 
+        # Convert True/False to 'true'/'false'
+        # because it will be rendered as C++ code
+        if (self.defaultValue is not None and
+                isinstance(self.defaultValue, bool)):
+            self.defaultValue = 'true' if self.defaultValue else 'false'
+
         super(Property, self).__init__(**kwargs)
 
     def is_enum(self):
diff --git a/tools/sdbusplus/templates/interface.mako.server.hpp b/tools/sdbusplus/templates/interface.mako.server.hpp
index b263c7a..0774fe5 100644
--- a/tools/sdbusplus/templates/interface.mako.server.hpp
+++ b/tools/sdbusplus/templates/interface.mako.server.hpp
@@ -139,7 +139,7 @@
         sdbusplus::SdBusInterface *_intf;
 
     % for p in interface.properties:
-        % if p.defaultValue:
+        % if p.defaultValue is not None:
         ${p.cppTypeParam(interface.name)} _${p.camelCase} = \
             % if p.is_enum():
 ${p.cppTypeParam(interface.name)}::\